chore: ci adjust

This commit is contained in:
DarkSky
2022-08-04 15:35:14 +08:00
parent 78b24891d5
commit 152522c228
5 changed files with 3 additions and 3 deletions

28
.github/deployment/Caddyfile-venus vendored Normal file
View File

@@ -0,0 +1,28 @@
:80 {
root /* ./dist
file_server {
precompressed br
}
encode {
zstd
gzip 9
}
@notStatic {
not path /*.css
not path /*.js
not path /*.png
not path /*.jpg
not path /*.svg
not path /*.ttf
not path /*.eot
not path /*.woff
not path /*.woff2
}
handle @notStatic {
try_files {path} /index.html
}
}

33
.github/deployment/Dockerfile-keck vendored Normal file
View File

@@ -0,0 +1,33 @@
FROM node:16-alpine as builder
WORKDIR /app
COPY . .
RUN apk add g++ make python3 git
RUN npm i -g pnpm@7 && pnpm i --frozen-lockfile --store=node_modules/.pnpm-store && pnpm run build:keck
FROM node:16-alpine as node_modules
WORKDIR /app
COPY --from=builder /app/dist/apps/keck .
COPY --from=builder /app/apps/keck/package.prod.json ./package.json
RUN npm i
# =============
# keck image
# =============
FROM node:16-alpine as keck
WORKDIR /app
COPY --from=node_modules /app .
ENV FIREBASE_ACCOUNT=
ENV FIREBASE_CERT=
ENV FIREBASE_PROJECT=
ENV HOST=0.0.0.0
ENV PORT=3000
# coding
ENV TZ 'Asia/Shanghai'
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
EXPOSE 3000
CMD ["node", "main.js"]

21
.github/deployment/Dockerfile-venus vendored Normal file
View File

@@ -0,0 +1,21 @@
FROM node:16-alpine as builder
WORKDIR /app
COPY . .
RUN apk add g++ make python3 git
RUN npm i -g pnpm@7 && pnpm i --frozen-lockfile --store=node_modules/.pnpm-store && pnpm run build:venus
FROM node:16-alpine as relocate
WORKDIR /app
COPY --from=builder /app/dist/apps/venus ./dist
COPY --from=builder /app/.github/deployment/Caddyfile-venus ./Caddyfile
RUN rm ./dist/*.txt
# =============
# venus image
# =============
FROM caddy:2.4.6-alpine as venus
WORKDIR /app
COPY --from=relocate /app .
EXPOSE 80
CMD ["caddy", "run"]

View File

@@ -60,7 +60,7 @@ jobs:
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: ./Dockerfile-keck
file: ./.github/deployment/Dockerfile-keck
push: ${{ github.ref == 'refs/heads/field' && true || false }}
tags: ${{ steps.meta_keck.outputs.tags }}
labels: ${{ steps.meta_keck.outputs.labels }}

View File

@@ -59,7 +59,7 @@ jobs:
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: ./Dockerfile-venus
file: ./.github/deployment/Dockerfile-venus
push: ${{ github.ref == 'refs/heads/master' && true || false }}
tags: ${{ steps.meta_venus.outputs.tags }}
labels: ${{ steps.meta_venus.outputs.labels }}