V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
jjnox
V2EX  ›  Docker

Dockefile 姿势问题

  •  1
     
  •   jjnox · 2022-08-30 02:53:40 +08:00 · 807 次点击
    这是一个创建于 605 天前的主题,其中的信息可能已经有所发展或是发生改变。
    # 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
       2022-08-30 03:05:30 +08:00
    已解决
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1367 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 17:50 · PVG 01:50 · LAX 10:50 · JFK 13:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.