[Docker] Dockefile 姿势问题

# one
FROM golang:1.17 as one
WORKDIR /src/
COPY . .
RUN apt-get update;\ apt-get install --yes --no-install-recommends make;\ make build
ENV PORT=8080
EXPOSE 8080
ENTRYPOINT ["./dist/butterfly", "serve"]

可以运行

# one
FROM golang:1.17 as one
WORKDIR /src/
COPY . .
RUN apt-get update;\ apt-get install --yes --no-install-recommends make;\ make build
# two
FROM scratch
WORKDIR /app/
COPY --from=one /src/dist/ /app/
ENV PORT=8080
EXPOSE 8080
ENTRYPOINT ["./butterfly", "serve"]

exec /app/butterfly; no such file or directory

发表回复

您的电子邮箱地址不会被公开。