32 lines
505 B
Docker
32 lines
505 B
Docker
|
FROM node:18-alpine AS build
|
||
|
|
||
|
|
||
|
#### RUN BUILD IN CONTAINER
|
||
|
|
||
|
# copy required files
|
||
|
WORKDIR /app
|
||
|
COPY . .
|
||
|
RUN npm install
|
||
|
RUN npm run build
|
||
|
|
||
|
# copy to actual container (prod)
|
||
|
FROM node:18-alpine AS web
|
||
|
|
||
|
WORKDIR /app
|
||
|
|
||
|
# copy required files
|
||
|
COPY --from=build /app/build /app/build
|
||
|
# COPY --from=build /app/migrations /app/migrations
|
||
|
COPY --from=build /app/package.json /app/package-lock.json .
|
||
|
|
||
|
|
||
|
# get production node modules
|
||
|
RUN npm ci --omit dev
|
||
|
|
||
|
# expose port
|
||
|
EXPOSE 3000
|
||
|
|
||
|
|
||
|
# run app
|
||
|
CMD ["node", "build"]
|