This commit is contained in:
parent
2f91b44bb8
commit
c011fe69c8
@ -11,7 +11,7 @@ steps:
|
|||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
registry: registry.cn-shanghai.aliyuncs.com
|
registry: registry.cn-shanghai.aliyuncs.com
|
||||||
repo: registry.cn-shanghai.aliyuncs.com/docker-echo
|
repo: registry.cn-shanghai.aliyuncs.com/docker-echo/docker
|
||||||
username:
|
username:
|
||||||
from_secret: xs765911
|
from_secret: xs765911
|
||||||
password:
|
password:
|
||||||
|
21
Dockerfile
21
Dockerfile
@ -1,10 +1,17 @@
|
|||||||
FROM golang:1.18 as builder
|
FROM golang:1.18 as builder
|
||||||
WORKDIR /build
|
|
||||||
|
|
||||||
|
WORKDIR /builder
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN CGO_ENABLED=0 GOPROXY=https://proxy.golang.com.cn,direct go build -o demo
|
RUN go mod download && go build -o app && upx -9 app
|
||||||
FROM alpine:3.10 as runner
|
RUN ls -lh && chmod +x ./app
|
||||||
LABEL description="the image is a demo"
|
|
||||||
|
|
||||||
|
# 指定创建的基础镜像
|
||||||
|
FROM alpine as runner
|
||||||
|
# 替换阿里云的源
|
||||||
|
RUN echo "http://mirrors.aliyun.com/alpine/latest-stable/main/" > /etc/apk/repositories
|
||||||
|
RUN echo "http://mirrors.aliyun.com/alpine/latest-stable/community/" >> /etc/apk/repositories
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=builder /build/demo /app/
|
COPY --from=builder /builder/app ./app
|
||||||
EXPOSE 8080
|
CMD ./app
|
||||||
ENTRYPOINT ["./demo"]
|
|
Loading…
Reference in New Issue
Block a user