From 6141888d3e1c0944127e813c2997d9b820471cef Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Fri, 4 Feb 2022 11:23:14 -0600 Subject: [PATCH] Create minimal build for nodejs environment that can run tensorflow --- server/Dockerfile-minimal | 40 +++++++++++++++++++++++++++++++++++++++ server/docker-compose.yml | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 server/Dockerfile-minimal diff --git a/server/Dockerfile-minimal b/server/Dockerfile-minimal new file mode 100644 index 0000000000..cbe50de964 --- /dev/null +++ b/server/Dockerfile-minimal @@ -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"] \ No newline at end of file diff --git a/server/docker-compose.yml b/server/docker-compose.yml index a95d86a272..fae9111f3c 100644 --- a/server/docker-compose.yml +++ b/server/docker-compose.yml @@ -8,7 +8,7 @@ services: build: context: . target: development - dockerfile: ./Dockerfile + dockerfile: ./Dockerfile-minimal command: yarn start:dev ports: - "3000:3000"