You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
881 B
28 lines
881 B
1 year ago
|
|
||
|
# build container
|
||
|
FROM golang:1.20-alpine3.18 AS builder
|
||
|
ENV GOPROXY https://goproxy.cn,direct
|
||
|
ENV GOSUMDB=sum.golang.google.cn
|
||
|
ENV GO111MODULE=on
|
||
|
|
||
|
WORKDIR /app
|
||
|
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||
|
RUN apk --no-cache add git pkgconfig build-base
|
||
|
ADD go.mod .
|
||
|
ADD go.sum .
|
||
|
RUN go mod download
|
||
|
ADD . .
|
||
|
RUN go build -o cmd/openim-msgtransfer/openim-msgtransfer cmd/openim-msgtransfer/main.go
|
||
|
|
||
|
# archive container
|
||
|
FROM alpine:3.18
|
||
|
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||
|
RUN apk --no-cache add ca-certificates libdrm
|
||
|
RUN apk add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
||
|
&& echo "Asia/Shanghai" > /etc/timezone \
|
||
|
&& apk del tzdata
|
||
|
|
||
|
WORKDIR /app/bin
|
||
|
COPY --from=builder /app/cmd/openim-msgtransfer/openim-msgtransfer /app/bin/
|
||
|
ENTRYPOINT ["/app/bin/openim-msgtransfer"]
|