forked from hequan2017/go-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
37 lines (26 loc) · 989 Bytes
/
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
FROM alpine:latest
USER root
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \
&& echo "export GO111MODULE=on" >> /etc/profile \
&& echo "export GOPATH=/root/go" >> /etc/profile \
&& echo "export GOPROXY=https://mirrors.aliyun.com/goproxy/" >> /etc/profile \
&& source /etc/profile
RUN apk update && apk add go git musl-dev xz binutils \
&& cd \
&& go get -u -v go-admin \
&& go install go-admin
RUN wget https://github.com/upx/upx/releases/download/v3.95/upx-3.95-amd64_linux.tar.xz \
&& xz -d upx-3.95-amd64_linux.tar.xz \
&& tar -xvf upx-3.95-amd64_linux.tar \
&& cd upx-3.95-amd64_linux \
&& chmod a+x ./upx \
&& mv ./upx /usr/local/bin/ \
&& cd /root/go/bin \
&& strip --strip-unneeded go-admin \
&& upx go-admin \
&& chmod a+x ./go-admin \
&& cp go-admin /usr/local/bin
FROM alpine:latest
COPY --from=0 /usr/local/bin/go-admin /usr/local/bin/
EXPOSE 80
CMD ["go-admin"]