Skip to content

Commit

Permalink
Merge pull request #28 from jokester/build-nginx-gzip
Browse files Browse the repository at this point in the history
package gzipped assets
  • Loading branch information
jokester authored Nov 5, 2024
2 parents af90956 + b8393f2 commit 8f37ebb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/deploy-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
- name: Build app
run: npm run build

- name: gzip static files # for nginx
run: find ./build -name '*.js' -or -name '*.css' -or -name '*.html' -or -name '*.json' | xargs -n 1 -P 8 gzip -9 --keep && find ./build

- name: Log in to the Container registry
uses: docker/[email protected]
with:
Expand Down
12 changes: 3 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
FROM scratch AS builder
# NOTE Dockerfile只用来打包 (否则给多个arch构建镜像会更慢)
# `docker build` 前应先执行 `npm run build` .
COPY . /app

#######

FROM nginx:1
COPY --from=builder /app/build /build
FROM nginx:1.26
# NOTE assuming `npm build` is executed, like in CI workflow.
COPY ./build /build

0 comments on commit 8f37ebb

Please sign in to comment.