further dockerfile caching and size optim

nodejs and js libraries are only needed at build time
This commit is contained in:
codl 2022-08-05 02:19:51 +02:00
parent 3497a63cff
commit c82c15e0da
1 changed files with 13 additions and 4 deletions

View File

@ -1,14 +1,19 @@
FROM python:3.10-bullseye AS deps
FROM python:3.10.6-bullseye AS pydeps
WORKDIR /usr/src/app
RUN python -m pip install --upgrade pip==22.2.2
RUN apt-get update -qq && apt-get install -qq nodejs npm
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
FROM pydeps AS pynodedeps
RUN apt-get update -qq && apt-get install -qq nodejs npm \
&& rm -rf /var/lib/apt/lists/*
COPY package.json package-lock.json ./
RUN npm install --save-dev
RUN npm clean-install
FROM scratch AS layer-cake
@ -24,11 +29,15 @@ COPY static static
COPY templates templates
FROM deps
FROM pynodedeps AS build
COPY --from=layer-cake / ./
RUN doit
FROM pydeps
COPY --from=build /usr/src/app ./
ENV FLASK_APP=forget.py
VOLUME ["/var/run/celery"]