简体   繁体   中英

Dockerized React app on Node - How to copy files?

So I have these env variables defining the SSL files and I want to copy them to my container, somehow they are not copied by default even if they are in my project folder.

You specified SSL_CRT_FILE in your env, but the file "/usr/src/app/server.cert" can't be found

Dockerfile

FROM node:10

MAINTAINER Kuba Wasilewski <jakub.wasilewski@sprint.pl>
 
WORKDIR /usr/src/app
 
COPY package*.json ./
 
RUN npm install
 
ARG REACT_APP_API_URL

ENV REACT_APP_API_URL ${REACT_APP_API_URL}

COPY . .

ENV HTTPS=true
# these are the files that are not copied by default
ENV SSL_CRT_FILE=server.cert
ENV SSL_KEY_FILE=server.key
 
EXPOSE 3000

CMD [ "npm", "start" ]

Since you have specified the working directory as /usr/src/app , the COPY commands should copy any project files to that location.

 FROM node:10 MAINTAINER Kuba Wasilewski <jakub.wasilewski@sprint.pl> WORKDIR /usr/src/app COPY package*.json /usr/src/app RUN npm install ARG REACT_APP_API_URL ENV REACT_APP_API_URL ${REACT_APP_API_URL} COPY. /usr/src/app ENV HTTPS=true # these are the files that are not copied by default ENV SSL_CRT_FILE=server.cert ENV SSL_KEY_FILE=server.key EXPOSE 3000 CMD [ "npm", "start" ]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM