diff --git a/.dockerignore b/.dockerignore index 840fbda4..70266df4 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1 @@ -* !hegel diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 21926d88..5c51ee6c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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] @@ -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: @@ -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 diff --git a/Dockerfile b/Dockerfile index ba953654..32223d60 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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