Compare commits
1 Commits
feat/optim
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| b330959cc5 |
@@ -11,7 +11,7 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build Homepage Image
|
name: Build Homepage Image
|
||||||
runs-on: ubuntu-amd64
|
runs-on: runner-slim-amd64
|
||||||
outputs:
|
outputs:
|
||||||
short_sha: ${{ steps.vars.outputs.short_sha }}
|
short_sha: ${{ steps.vars.outputs.short_sha }}
|
||||||
steps:
|
steps:
|
||||||
@@ -33,7 +33,7 @@ jobs:
|
|||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
name: Deploy Homepage
|
name: Deploy Homepage
|
||||||
runs-on: ubuntu-amd64
|
runs-on: runner-slim-amd64
|
||||||
needs: build
|
needs: build
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build Homepage Image
|
name: Build Homepage Image
|
||||||
runs-on: ubuntu-amd64
|
runs-on: runner-slim-amd64
|
||||||
outputs:
|
outputs:
|
||||||
short_sha: ${{ steps.vars.outputs.short_sha }}
|
short_sha: ${{ steps.vars.outputs.short_sha }}
|
||||||
steps:
|
steps:
|
||||||
@@ -39,7 +39,7 @@ jobs:
|
|||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
name: Deploy Homepage
|
name: Deploy Homepage
|
||||||
runs-on: ubuntu-amd64
|
runs-on: runner-slim-amd64
|
||||||
needs: build
|
needs: build
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
|
|||||||
17
Dockerfile
17
Dockerfile
@@ -4,21 +4,16 @@ WORKDIR /src
|
|||||||
|
|
||||||
COPY . /src
|
COPY . /src
|
||||||
|
|
||||||
# Build a production-only copy so the source tree remains useful for local
|
# Install terser to minify JS files
|
||||||
# development and the final image contains no unminified source assets.
|
RUN npm install -g terser
|
||||||
RUN npm install --global --no-audit --no-fund --no-update-notifier \
|
RUN if [ -d "js" ]; then find js -type f -name "*.js" -exec sh -c 'for f; do terser "$f" -c -m -o "$f"; done' sh {} +; fi
|
||||||
terser@5.49.0 clean-css-cli@5.6.3 html-minifier-terser@7.2.0 \
|
|
||||||
&& mkdir -p /src/dist/css /src/dist/js \
|
|
||||||
&& find css -type f -name '*.css' -exec sh -c 'for file do target="/src/dist/$file"; mkdir -p "$(dirname "$target")"; cleancss -O 1 --output "$target" "$file"; done' sh {} + \
|
|
||||||
&& find js -type f -name '*.js' -exec sh -c 'for file do target="/src/dist/$file"; mkdir -p "$(dirname "$target")"; terser "$file" --compress --mangle --comments false --output "$target"; done' sh {} + \
|
|
||||||
&& find . -maxdepth 1 -type f -name '*.html' -exec sh -c 'for file do target="/src/dist/$file"; html-minifier-terser --collapse-whitespace --remove-comments --remove-redundant-attributes --use-short-doctype --minify-css=true --minify-js=true "$file" --output "$target"; done' sh {} + \
|
|
||||||
&& cp -R assets /src/dist/assets
|
|
||||||
|
|
||||||
FROM nginx:alpine-slim AS final
|
FROM nginx:alpine-slim AS final
|
||||||
|
|
||||||
COPY nginx.conf /etc/nginx/nginx.conf
|
COPY nginx.conf /etc/nginx/nginx.conf
|
||||||
COPY --from=build /src/dist /usr/share/nginx/html
|
COPY . /usr/share/nginx/html
|
||||||
|
COPY --from=build /src/js /usr/share/nginx/html/js
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
Reference in New Issue
Block a user