Skip to content

Commit

Permalink
Merge pull request #10 from timoreimann/build-inside-container
Browse files Browse the repository at this point in the history
Build pdsync inside a container
  • Loading branch information
timoreimann authored Apr 18, 2023
2 parents a0097d2 + 86508e3 commit 50111fe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,16 @@ jobs:
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Test
run: go test -mod=vendor ./...

build-container:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Set up Docker
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2.5.0
- name: Build
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
with:
push: false
tags: pdsync
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM golang:alpine as cert-store
RUN apk --no-cache add ca-certificates
FROM amd64/golang:1.20.3-alpine3.17 as builder

FROM scratch
WORKDIR /usr/src/pdsync

COPY --from=cert-store /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY ./pdsync /
COPY . .
RUN CGO_ENABLED=0 go build -mod vendor -o /pdsync

FROM gcr.io/distroless/static-debian11 as runner
COPY --from=builder /pdsync /
ENTRYPOINT ["/pdsync"]

0 comments on commit 50111fe

Please sign in to comment.