# pull the base image
FROM node:alpine

# Build args
ARG NODE_ENV

# set the working direction
#WORKDIR /app
WORKDIR /usr/src/app

# add `/app/node_modules/.bin` to $PATH
# ENV PATH /app/node_modules/.bin:$PATH
ENV PATH /usr/src/app/node_modules/.bin:$PATH
ENV NODE_ENV=$NODE_ENV

# install nginx
RUN apk update
RUN apk add nginx

# install app dependencies
COPY package.json ./

COPY package-lock.json ./

COPY nginx.conf ./

COPY run.sh ./

RUN npm install --legacy-peer-deps

# add app
COPY . ./

# start app
CMD /bin/sh ./run.sh

