Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: reduce docker image size #1523

Merged
merged 8 commits into from
Feb 3, 2023
10 changes: 1 addition & 9 deletions machine-learning/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@

FROM node:16-bullseye-slim as builder

ARG DEBIAN_FRONTEND=noninteractive

WORKDIR /usr/src/app

RUN apt-get update
RUN apt-get install gcc g++ make cmake python3 python3-pip ffmpeg -y
RUN apt-get install gcc g++ make cmake python3 python3-pip -y

COPY package.json package-lock.json ./

Expand All @@ -15,24 +14,17 @@ RUN npm rebuild @tensorflow/tfjs-node --build-from-source

COPY . .


FROM builder as prod

RUN npm run build

RUN npm prune --omit=dev


FROM node:16-bullseye-slim

ARG DEBIAN_FRONTEND=noninteractive

WORKDIR /usr/src/app

RUN apt-get update \
&& apt-get install -y ffmpeg \
&& rm -rf /var/cache/apt/lists

COPY --from=prod /usr/src/app/node_modules ./node_modules
COPY --from=prod /usr/src/app/dist ./dist

Expand Down
122 changes: 0 additions & 122 deletions machine-learning/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion machine-learning/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"@tensorflow/tfjs-converter": "^3.19.0",
"@tensorflow/tfjs-core": "^3.19.0",
"@tensorflow/tfjs-node": "^3.19.0",
"@tensorflow/tfjs-node-gpu": "^3.19.0",
"@trpc/server": "^9.20.3",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
Expand Down