-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile
40 lines (27 loc) · 900 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
34
35
36
37
38
39
40
FROM golang:1.23-alpine3.19 as builder
RUN apk update && apk add --no-cache gcc musl-dev ca-certificates
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG GIT_TAG
ARG GIT_COMMIT
ARG GIT_BRANCH
RUN BUILD_DATE=$(date +'%Y-%m-%dT%H:%M:%S%z') && \
go build -ldflags "-X 'main.version=${GIT_TAG}' -X 'main.gitCommit=${GIT_COMMIT}' -X 'main.gitBranch=${GIT_BRANCH}' -X 'main.buildDate=${BUILD_DATE}'" -o main
FROM alpine:3.21.0 as prod
WORKDIR /app
COPY --from=builder /app/main .
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY probe.js .
COPY src ./src
EXPOSE 1449
CMD ["./main"]
FROM golang:1.23-alpine3.19 as dev
RUN apk update && apk add --no-cache gcc musl-dev ca-certificates
RUN go install github.com/air-verse/air@latest
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
CMD ["air", "-c", ".air.toml"]