From c733adca93f91daf3f66b75e4561cbc5d1228012 Mon Sep 17 00:00:00 2001 From: Alexis Couvreur Date: Wed, 21 Oct 2020 12:57:00 +0200 Subject: [PATCH] Added github action build multi arch --- .dockerignore | 1 + .github/workflows/ci.yaml | 41 +++++++++++++++++++++++++++++++++++++++ Dockerfile | 6 ++++++ 3 files changed, 48 insertions(+) create mode 100644 .dockerignore create mode 100644 .github/workflows/ci.yaml create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..efa6632 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +bin/* \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..c752909 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,41 @@ +name: Continuous Integration + +on: + push: + paths-ignore: + - "*.md" + branches: + - master + +jobs: + ci: + name: CI + runs-on: ubuntu-latest + env: + DOCKER_BUILDKIT: "1" + steps: + - + name: Checkout code + uses: actions/checkout@v2 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + 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: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 + push: true + tags: | + acouvreur/traefik-ondemand-service:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..652dcc3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM golang:1.15.3-alpine AS build +WORKDIR /src +COPY . . +RUN go build -o ondemand-service . +FROM scratch AS bin +COPY --from=build ondemand-service / \ No newline at end of file