slim images, building to docker hub from github

This commit is contained in:
Andy Pack 2023-05-16 17:47:50 +01:00
parent c5d923f7a6
commit d91ef2996d
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7
3 changed files with 36 additions and 5 deletions

View File

@ -1,4 +1,7 @@
.github
.jenkins
.git
pkg pkg
target target
dist **/dist
node_modules **/node_modules

View File

@ -45,3 +45,31 @@ jobs:
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./www/dist publish_dir: ./www/dist
package:
runs-on: ubuntu-latest
needs: [build] # for ignoring bad builds
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build CLI Container
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/amd64,linux/arm64
tags: sarsoo/game-of-life:latest

View File

@ -1,4 +1,4 @@
FROM rust:1.69 AS rust-build FROM rust:1.69-alpine AS rust-build
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
@ -8,7 +8,7 @@ WORKDIR /gof
RUN wasm-pack build --release RUN wasm-pack build --release
RUN cargo doc --no-deps --document-private-items RUN cargo doc --no-deps --document-private-items
FROM node:18 AS js-build FROM node:18-alpine AS js-build
COPY . /gof COPY . /gof
WORKDIR /gof WORKDIR /gof
@ -19,5 +19,5 @@ RUN npm ci
RUN npm run build --if-present RUN npm run build --if-present
COPY --from=rust-build /gof/target/doc /gof/www/dist/ COPY --from=rust-build /gof/target/doc /gof/www/dist/
FROM nginx FROM nginx:alpine-slim
COPY --from=js-build /gof/www/dist /usr/share/nginx/html/ COPY --from=js-build /gof/www/dist /usr/share/nginx/html/