diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e03e574 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +# 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 + +# add app +COPY . ./ + +# start app +CMD /bin/sh ./run.sh + diff --git a/docker-compose.yml b/docker-compose.yml index 2133e78..ce7f718 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,7 @@ services: image: registry.chiefsoft.net/wrenchboard-users-wrench:latest build: context: . - dockerfile: docker/Dockerfile + dockerfile: Dockerfile args: - NODE_ENV=production restart: unless-stopped diff --git a/package.json b/package.json index 5f02a8a..3fe2dda 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,8 @@ "yup": "^1.1.1" }, "scripts": { - "start": "react-scripts start", - "build": "react-scripts build", + "start": "react-scripts start -e .env.development", + "build": "react-scripts build -e .env.production", "test": "react-scripts test", "eject": "react-scripts eject", "lint": "yarn add -D prettier@2.4.1 && yarn add -D eslint@7.11.0 && yarn add -D babel-eslint@10.1.0 && npx install-peerdeps --dev eslint-config-airbnb@18.2.1 && yarn add -D eslint-config-prettier@8.3.0 eslint-plugin-prettier@4.0.0"