diff --git a/Dockerfile b/Dockerfile index 1f5bbf1..66e37fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,22 @@ -FROM node:alpine +FROM node:12-alpine as base WORKDIR /usr/app -COPY ./server/package.json . -COPY ./server/package-lock.json . -COPY ./server/prisma . +ARG NODE_ENV=production +ENV NODE_ENV=$NODE_ENV +EXPOSE 5000 -RUN npm install\ - && npm install typescript -g +# App and dev dependencies +COPY ["package.json", "package-lock.json", "prisma", "./"] -COPY ./server . +RUN npm install -RUN touch ./.env +# App source +COPY . . + +# Build step for production +FROM base + +RUN npm install typescript -RUN tsc CMD ["node", "./dist/app.js"] \ No newline at end of file