diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4cb9552..cac23c4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,6 +4,7 @@ on: # Triggers the workflow on push or pull request events but only for the main branch push: branches: [ main ] + tags: [v*] pull_request: branches: [ main ] @@ -49,3 +50,28 @@ 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' }} + 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"]