Skip to content
Snippets Groups Projects
Dockerfile 613 B
Newer Older
# First build the client
FROM node:12.16.3 as clientbuild

RUN mkdir /usr/src/app
WORKDIR /usr/src/app

Falk's avatar
Falk committed
COPY ./app/client/package*.json ./

ENV PATH /usr/src/app/node_modules/.bin:$PATH
ENV API_URL todo-application-service:3002

RUN npm install --silent
Falk's avatar
Falk committed
COPY ./app/client .

RUN API_URL=$API_URL node scripts/build.js
# Client build finished

# Build Server and combine
FROM node:12.16.3

WORKDIR "/usr/app"
COPY ./app/server/package.json .
RUN npm install --production
Falk's avatar
Falk committed
COPY ./app/server .
# Copy client app into public folder
COPY --from=clientbuild /usr/src/app/build ./public

EXPOSE 3002
CMD ["npm", "start"]