-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (25 loc) · 757 Bytes
/
Dockerfile
File metadata and controls
38 lines (25 loc) · 757 Bytes
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
FROM golang:1.20 as build
WORKDIR /app
COPY go.mod /app/
COPY go.sum /app/
ARG USERNAME_GITHUB
ARG TOKEN_GITHUB
RUN git config --global url."https://${USERNAME_GITHUB}:${TOKEN_GITHUB}@github.com".insteadOf "https://github.com"
RUN go mod download
RUN go mod tidy
COPY . /app/
ARG BUILD_TAG
ARG BUILD_TIMESTAMP
RUN CGO_ENABLED=0 go build -o /app/main -ldflags="-X 'main.buildTime=${BUILD_TIMESTAMP}' -X 'main.buildVer=${BUILD_TAG}'"
# Deploy
FROM alpine:3.16.0
WORKDIR /app
EXPOSE 7780
EXPOSE 7781
RUN apk update
RUN apk add --no-cache tzdata
ENV cp /usr/share/zoneinfo/Asia/Makassar /etc/localtime
RUN echo "Asia/Makassar" > /etc/timezone
COPY --from=build /app/conf /app/conf
COPY --from=build /app/main /app/sp-gateway
CMD ["/app/sp-gateway"]