This repository has been archived by the owner on Jun 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile
66 lines (57 loc) · 1.93 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#FROM golang:alpine AS build
#WORKDIR $GOPATH/src
FROM alpine:latest AS build
WORKDIR /apps
ARG TARGETPLATFORM
ARG BUILDPLATFORM
COPY . .
RUN ls -lh && echo $TARGETPLATFORM \
&& [[ "$TARGETPLATFORM" == "linux/amd64" ]] \
&& mv /apps/opqbot-manager-amd64 /apps/opqbot-manager || echo "not amd64" \
&& [[ "$TARGETPLATFORM" == "linux/arm64" ]] \
&& mv /apps/opqbot-manager-arm64 /apps/opqbot-manager || echo "not arm64" \
&& [[ "$TARGETPLATFORM" == "linux/arm/v7" ]] \
&& mv /apps/opqbot-manager-arm /apps/opqbot-manager || echo "not arm" \
&& [[ "$TARGETPLATFORM" == "linux/386" ]] \
&& mv /apps/opqbot-manager-386 /apps/opqbot-manager || echo "not 386"
# if [[ "$TARGETPLATFORM" = "linux/amd64" ]]; \
# then \
# mv ./opqbot-manager-amd64 ./opqbot-manager; \
# fi \
# && if ["$TARGETPLATFORM" = "linux/arm64"]; \
# then \
# mv ./opqbot-manager-arm64 ./opqbot-manager; \
# fi \
# && if ["$TARGETPLATFORM" = "linux/arm/v7"]; \
# then \
# mv ./opqbot-manager-arm ./opqbot-manager; \
# fi \
# && if ["$TARGETPLATFORM" = "linux/386"]; \
# then \
# mv ./opqbot-manager-386 ./opqbot-manager; \
# fi
RUN apk add upx \
&& upx opqbot-manager \
|| echo "UPX Install Failed!"
# RUN go mod tidy\
# && go build -o opqbot-manager -ldflags="-s -w" . \
# && apk add upx \
# && upx opqbot-manager \
# || echo "UPX Install Failed!"
FROM alpine:latest
LABEL MAINTAINER enjoy<i@mcenjoy.cn>
ENV VERSION 1.0
# create a new dir
WORKDIR /apps
COPY --from=build /apps/opqbot-manager /apps/opqbot-manager
COPY config.yaml.example /apps/
COPY font.ttf /apps/
COPY dictionary.txt /apps/
# 设置时区
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
# 设置编码
ENV LANG C.UTF-8
EXPOSE 8888
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
# 开RUN
ENTRYPOINT ["/apps/opqbot-manager"]