Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test docker build job #61

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]

Expand Down Expand Up @@ -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 }}
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]