How to source a script with environment variables in a docker build process?

前端 未结 4 846
孤独总比滥情好
孤独总比滥情好 2020-12-06 07:04

I\'m creating an image that has a similar problem like the following docker project:

Dockerfile

FROM alpine:3.9.3

COPY ./env.sh /env.sh
RUN source         


        
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-06 08:02

    I found an alternative option that I like better:

    Configure an ENTRYPOINT dockerfile step, that sources the file, and then runs the CMD received by argument:

    ENTRYPOINT ["sh", "-c", "source /env.sh && \"$@\"", "-s"]
    

提交回复
热议问题