Add Dockerfile + build action (#3)

* Add Dockerfile + build action

* Remove 'test' entry that didn't trigger action
This commit is contained in:
Mark Street 2022-06-30 20:30:24 +01:00 committed by Mark Street
parent d92f0d1d08
commit 29f93f0d1c
3 changed files with 67 additions and 0 deletions

7
.dockerignore Normal file
View File

@ -0,0 +1,7 @@
.git/
.vscode/
build/
test/
Dockerfile
README.md

42
.github/workflows/docker.yaml vendored Normal file
View File

@ -0,0 +1,42 @@
name: Create and push Docker build image
on:
push:
branches: [ main ]
tags: [ 'v*.*.*' ]
jobs:
public_docker_image:
name: Publish Docker image to Github Registry
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/decompals/wibo
- name: Check out the repo
uses: actions/checkout@v2
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: mkst
password: ${{ secrets.GHCR_PAT }}
- name: Build and push to Github registry (latest)
uses: docker/build-push-action@v2
with:
push: true
tags: ghcr.io/ghcr.io/decompals/wibo:latest
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
- name: Build and push to Github registry (versioned)
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
if: ${{ startsWith(github.ref, 'refs/tags/v') }}

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM ubuntu:22.04 as build
RUN apt-get update && apt-get install -y --no-install-recommends g++ g++-multilib make
COPY . /WiBo
RUN make -C /WiBo
FROM ubuntu:22.04
RUN dpkg --add-architecture i386 \
&& apt-get update \
&& apt-get install -y --no-install-recommends libstdc++6:i386
COPY --from=build /WiBo/wibo /usr/local/sbin/wibo
CMD /usr/local/sbin/wibo