slim images, building to docker hub from github actions

This commit is contained in:
Andy Pack 2023-05-16 17:46:13 +01:00
parent f06b5b202a
commit 399ed615d3
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
target
dist
node_modules
**/dist
**/node_modules

View File

@ -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

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
@ -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/