Create minimal build for nodejs environment that can run tensorflow

This commit is contained in:
Alex Tran 2022-02-04 11:23:14 -06:00
parent 09964e4b16
commit 6141888d3e
2 changed files with 41 additions and 1 deletions

40
server/Dockerfile-minimal Normal file
View file

@ -0,0 +1,40 @@
FROM node:16-bullseye-slim AS development
ARG DEBIAN_FRONTEND=noninteractive
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN apt-get update
RUN apt-get install gcc g++ make cmake python3 python3-pip -y
RUN npm i -g yarn --force
RUN yarn install
COPY . .
RUN yarn build
FROM node:16-bullseye-slim as production
ARG DEBIAN_FRONTEND=noninteractive
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN apt-get update
RUN apt-get install gcc g++ make cmake python3 python3-pip -y
RUN npm i -g yarn --force
RUN yarn install --only=production
COPY . .
COPY --from=development /usr/src/app/dist ./dist
CMD ["node", "dist/main"]

View file

@ -8,7 +8,7 @@ services:
build:
context: .
target: development
dockerfile: ./Dockerfile
dockerfile: ./Dockerfile-minimal
command: yarn start:dev
ports:
- "3000:3000"