-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
33 lines (23 loc) · 892 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# build application
FROM golang:1.21.0-alpine AS builder
ENV GOPRIVATE=github.com/vbyazilim
ARG GITHUB_ACCESS_TOKEN
ARG BUILD_INFORMATION
# hadolint ignore=DL3018
RUN apk add --update --no-cache git \
&& git config --global url.https://${GITHUB_ACCESS_TOKEN}@github.com/.insteadOf https://github.com/
WORKDIR /build
COPY ./go.mod /build/
# COPY ./go.mod ./go.sum /build/
# RUN go mod download
COPY . /build
RUN GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -ldflags="-X 'github.com/vbyazilim/kvstore/src/releaseinfo.BuildInformation=${BUILD_INFORMATION}'" -o app ./cmd/server
# get certificates
FROM alpine:3.18.3 AS certs
# hadolint ignore=DL3018
RUN apk add --update --no-cache ca-certificates
FROM busybox:1.36
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /build/app /kvstoreapp
EXPOSE 8000
CMD ["/kvstoreapp"]