-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (22 loc) · 826 Bytes
/
Dockerfile
File metadata and controls
32 lines (22 loc) · 826 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
FROM golang:alpine AS builder
WORKDIR /build
COPY . .
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
RUN apk add --no-cache git
RUN go env -w GO111MODULE=on \
&& go env -w GOPROXY=https://goproxy.cn,direct \
&& go env -w CGO_ENABLED=0 \
&& go env \
&& go mod tidy \
&& go build -ldflags "-X main.version=$(git describe --tags `git rev-list --tags --max-count=1`)" -o server .
FROM ubuntu:22.04
LABEL MAINTAINER="dalefengs@gmail.com"
WORKDIR /app
RUN apt-get update -y && apt-get upgrade -y
RUN apt-get install -y tzdata \
ca-certificates vim && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
COPY --from=builder /build/server ./
COPY --from=builder /build/config.docker.yaml ./
EXPOSE 8818
ENTRYPOINT ./server -c config.docker.yaml