From 399ed615d3990aba21d4b042aefb0f3dccf3c484 Mon Sep 17 00:00:00 2001 From: Andy Pack Date: Tue, 16 May 2023 17:46:13 +0100 Subject: [PATCH] slim images, building to docker hub from github actions --- .dockerignore | 7 +++++-- .github/workflows/test.yml | 28 ++++++++++++++++++++++++++++ Dockerfile | 6 +++--- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/.dockerignore b/.dockerignore index 4406b23..77d1a3e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,7 @@ +.github +.jenkins +.git pkg target -dist -node_modules \ No newline at end of file +**/dist +**/node_modules \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8823db3..d6abf59 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -51,3 +51,31 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} 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/draught:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 5027078..ff35b21 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -8,7 +8,7 @@ WORKDIR /draught RUN wasm-pack build --release RUN cargo doc --no-deps --document-private-items -FROM node:18 AS js-build +FROM node:18-alpine AS js-build COPY . /draught WORKDIR /draught @@ -19,5 +19,5 @@ RUN npm ci RUN npm run build --if-present COPY --from=rust-build /draught/target/doc /draught/www/dist/ -FROM nginx +FROM nginx:alpine-slim COPY --from=js-build /draught/www/dist /usr/share/nginx/html/ \ No newline at end of file