From ae8fb12c13f55b1b7737b7ed7bfcf801cb56233a Mon Sep 17 00:00:00 2001 From: Asmund Tokheim Date: Sun, 31 Oct 2021 20:22:59 +0100 Subject: [PATCH 1/2] Test docker build job Signed-off-by: Asmund Tokheim --- .github/workflows/main.yml | 29 ++++++++++++++++++++++++++++- Dockerfile | 16 ++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4cb9552..a152df9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,8 @@ name: CI on: # Triggers the workflow on push or pull request events but only for the main branch push: - branches: [ main ] + branches: [ dockerjob ] + tags: [v*] pull_request: branches: [ main ] @@ -49,3 +50,29 @@ jobs: # Run integration tests - name: Integration tests run: make docker-integration-tests + + docker: + needs: integration + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: tokheim/amqpproxy + - name: Login to Dockerhub + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + #push: ${{ github.event_name != 'pull_request' }} + push: false + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b5ed619 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM conanio/clang9 AS builder +RUN sudo apt-get update && sudo apt-get install -y llvm +ENV BUILDDIR=/home/conan/build +ENV CONAN_USER_HOME=/home/conan +COPY . ./source +WORKDIR /home/conan/source +RUN make setup && make init && make + +FROM ubuntu:focal +WORKDIR /amqpproxy +COPY --from=builder /home/conan/build/bin/ ./ +RUN useradd -ms /bin/bash amqpproxy && \ + chown -R amqpproxy /amqpproxy && \ + chmod -R 755 /amqpproxy +USER amqpproxy +CMD ["./amqpprox"] From 555e4ec11bd47409d7ceae9e6a2de136f570ee48 Mon Sep 17 00:00:00 2001 From: Asmund Tokheim Date: Sun, 31 Oct 2021 20:53:16 +0100 Subject: [PATCH 2/2] Revert settings used to test docker build Signed-off-by: Asmund Tokheim --- .github/workflows/main.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a152df9..cac23c4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ name: CI on: # Triggers the workflow on push or pull request events but only for the main branch push: - branches: [ dockerjob ] + branches: [ main ] tags: [v*] pull_request: branches: [ main ] @@ -72,7 +72,6 @@ jobs: uses: docker/build-push-action@v2 with: context: . - #push: ${{ github.event_name != 'pull_request' }} - push: false + push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}