-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from jokester/build-nginx-gzip
package gzipped assets
- Loading branch information
Showing
2 changed files
with
6 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |