Skip to content

Commit 50111fe

Browse files
authored
Merge pull request #10 from timoreimann/build-inside-container
Build pdsync inside a container
2 parents a0097d2 + 86508e3 commit 50111fe

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

.github/workflows/test.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,16 @@ jobs:
1515
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
1616
- name: Test
1717
run: go test -mod=vendor ./...
18+
19+
build-container:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
24+
- name: Set up Docker
25+
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2.5.0
26+
- name: Build
27+
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
28+
with:
29+
push: false
30+
tags: pdsync

Dockerfile

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
FROM golang:alpine as cert-store
2-
RUN apk --no-cache add ca-certificates
1+
FROM amd64/golang:1.20.3-alpine3.17 as builder
32

4-
FROM scratch
3+
WORKDIR /usr/src/pdsync
54

6-
COPY --from=cert-store /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
7-
COPY ./pdsync /
5+
COPY . .
6+
RUN CGO_ENABLED=0 go build -mod vendor -o /pdsync
7+
8+
FROM gcr.io/distroless/static-debian11 as runner
9+
COPY --from=builder /pdsync /
810
ENTRYPOINT ["/pdsync"]

0 commit comments

Comments
 (0)