测试容器编译
This commit is contained in:
parent
b0a8c9e2c2
commit
bc8512edcf
|
|
@ -15,3 +15,4 @@
|
|||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
|
||||
hello
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
FROM golang:1.18 as builder
|
||||
|
||||
ENV GO111MODULE=on \
|
||||
GOPROXY=https://goproxy.io
|
||||
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
|
||||
RUN go get && go build -ldflags="-s -w" -installsuffix cgo -o hello
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
ENV TZ=Asia/Shanghai \
|
||||
LANG=C.UTF-8 \
|
||||
APP_DIR=/app
|
||||
|
||||
COPY --from=builder /app/hello ${APP_DIR}/hello
|
||||
|
||||
WORKDIR ${APP_DIR}
|
||||
|
||||
RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime \
|
||||
&& echo ${TZ} > /etc/timezone \
|
||||
&& chmod +x hello
|
||||
|
||||
# EXPOSE 5678
|
||||
|
||||
CMD ["./hello"]
|
||||
Loading…
Reference in New Issue