Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Dockerfile review #71

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
FROM golang:1.21.1-bullseye
FROM golang:1.21.1 as builder

WORKDIR /go/src/

COPY . .
RUN go build ./cmd/server/
EXPOSE 8081

RUN CGO_ENABLED=1 GOOS=linux go build -o ./server --ldflags '-w -s -extldflags "-static"' ./cmd/server/

FROM alpine:3.18 as alpine

RUN apk add -U --no-cache ca-certificates

FROM scratch as runner

WORKDIR /app

COPY --from=builder /go/src/server .
COPY --from=builder /go/src/api/config/config.toml ./api/config/config.toml
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
EXPOSE 8081
CMD ["./server"]
Loading