V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
jjnox
V2EX  ›  Docker

Dockefile 姿势问题

  •  1
     
  •   jjnox · Aug 30, 2022 · 1529 views
    This topic created in 1343 days ago, the information mentioned may be changed or developed.
    # 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

    jjnox
        1
    jjnox  
    OP
       Aug 30, 2022
    已解决
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2478 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 07:16 · PVG 15:16 · LAX 00:16 · JFK 03:16
    ♥ Do have faith in what you're doing.