- nginx:alpine 托管静态站点 - push 到 main 自动构建并部署到 30000 端口
This commit is contained in:
@@ -0,0 +1,41 @@
|
|||||||
|
name: Deploy Examination
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: aliyun
|
||||||
|
steps:
|
||||||
|
- name: Setup Environment
|
||||||
|
run: |
|
||||||
|
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||||
|
apk add --no-cache docker-cli
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
run: |
|
||||||
|
rm -rf /tmp/examination
|
||||||
|
git clone --depth 1 -b main \
|
||||||
|
http://47.121.181.112:3000/wonder/examination.git \
|
||||||
|
/tmp/examination
|
||||||
|
|
||||||
|
- name: Build Docker Image
|
||||||
|
run: |
|
||||||
|
docker build \
|
||||||
|
-t examination-site:latest \
|
||||||
|
/tmp/examination
|
||||||
|
|
||||||
|
- name: Deploy Container
|
||||||
|
run: |
|
||||||
|
docker stop examination-site 2>/dev/null || true
|
||||||
|
docker rm examination-site 2>/dev/null || true
|
||||||
|
docker run -d \
|
||||||
|
--name examination-site \
|
||||||
|
--restart unless-stopped \
|
||||||
|
-p 30000:80 \
|
||||||
|
examination-site:latest
|
||||||
|
|
||||||
|
- name: Cleanup Dangling Images
|
||||||
|
run: docker image prune -f
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
FROM nginx:alpine
|
||||||
|
COPY . /usr/share/nginx/html
|
||||||
|
EXPOSE 80
|
||||||
Reference in New Issue
Block a user