Skip to content

Commit

Permalink
Merge pull request tinkerbell#47 from gianarb/chore/build-in-docker
Browse files Browse the repository at this point in the history
Multi arch support for Docker image
  • Loading branch information
mmlb authored Oct 28, 2020
2 parents aeb1cb7 + 2cd8b6c commit 916276c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
*
!hegel
22 changes: 6 additions & 16 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ jobs:
run: go test -coverprofile=coverage.txt ./...
- name: upload codecov
run: bash <(curl -s https://codecov.io/bash)
- name: Build binaries
run: go build
- name: Upload hegel binary
uses: actions/upload-artifact@v2
with:
name: hegel
path: ./hegel
docker-images:
runs-on: ubuntu-latest
needs: [validation]
Expand All @@ -47,21 +40,17 @@ jobs:
echo ::set-output name=tags::quay.io/tinkerbell/hegel:latest,quay.io/tinkerbell/hegel:sha-${GITHUB_SHA::8}
- name: Checkout code
uses: actions/checkout@v2
- name: Download hegel binary
uses: actions/download-artifact@v2
with:
name: hegel
path: ./hegel
- name: set hegel permission
run: chmod +x ./hegel
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to quay.io
uses: docker/login-action@v1
if: ${{ startsWith(github.ref, 'refs/heads/master') }}
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: quay.io/tinkerbell/hegel
uses: docker/build-push-action@v2
with:
Expand All @@ -70,3 +59,4 @@ jobs:
cache-from: type=registry,ref=quay.io/tinkerbell/hegel:latest
push: ${{ startsWith(github.ref, 'refs/heads/master') }}
tags: ${{ steps.docker-image-tag.outputs.tags }}
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
FROM golang:1.15-alpine
COPY . /usr/myapp
WORKDIR /usr/myapp
RUN mkdir bin && go build -o ./bin ./...

FROM alpine:3.7

EXPOSE 50060
EXPOSE 50061
ENTRYPOINT [ "cmd/hegel" ]
ENTRYPOINT ["/usr/bin/hegel"]

RUN apk add --update --upgrade ca-certificates
ADD hegel cmd/hegel
COPY --from=0 /usr/myapp/bin/hegel /usr/bin/hegel

0 comments on commit 916276c

Please sign in to comment.