FROM node:10

ARG env_file=.env.development

COPY . .

WORKDIR app/

RUN yarn add global gatsby-cli
RUN yarn install

#configure .env file from --build-arg specified file
RUN cp $env_file .temp_env
RUN rm .env*
RUN cp .temp_env .env.development; rm .temp_env

# RUN npm run build

# expose required ports
EXPOSE 80
EXPOSE 1337
EXPOSE 8000

# start app
CMD [ "npm", "start" ]
