-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (25 loc) · 797 Bytes
/
Dockerfile
File metadata and controls
35 lines (25 loc) · 797 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
FROM golang:1.21-alpine AS builder
LABEL maintainer="Anonymous"
ARG LDFLAGS_NAME="-X main.name="
ARG LDFLAGS_VERSION="-X main.version="
ARG ENTRY="./cmd"
ARG PRODUCT="./bin"
ENV NAME="ip-service"
ENV VERSION="1.0"
WORKDIR /app
COPY . .
RUN go mod download \
&& go clean \
&& go build -ldflags "${LDFLAGS_NAME}${NAME} ${LDFLAGS_VERSION}${VERSION}" -o ${PRODUCT}/start ${ENTRY}
FROM alpine:3.7
LABEL maintainer="Anonymous"
COPY --from=builder /app/bin/start /app/
COPY application.yml /app/
ENV TZ=Asia/Shanghai
RUN echo -e https://mirrors.aliyun.com/alpine/v3.7/main/ > /etc/apk/repositories && \
apk add --no-cache tzdata \
&& ln -sf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone \
&& chmod +x /app/start
WORKDIR /app
ENTRYPOINT ["./start"]