further dockerfile caching and size optim
nodejs and js libraries are only needed at build time
This commit is contained in:
parent
3497a63cff
commit
c82c15e0da
17
Dockerfile
17
Dockerfile
|
@ -1,14 +1,19 @@
|
||||||
FROM python:3.10-bullseye AS deps
|
FROM python:3.10.6-bullseye AS pydeps
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
RUN python -m pip install --upgrade pip==22.2.2
|
RUN python -m pip install --upgrade pip==22.2.2
|
||||||
RUN apt-get update -qq && apt-get install -qq nodejs npm
|
|
||||||
|
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install --no-cache-dir -r 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 ./
|
COPY package.json package-lock.json ./
|
||||||
RUN npm install --save-dev
|
RUN npm clean-install
|
||||||
|
|
||||||
|
|
||||||
FROM scratch AS layer-cake
|
FROM scratch AS layer-cake
|
||||||
|
@ -24,11 +29,15 @@ COPY static static
|
||||||
COPY templates templates
|
COPY templates templates
|
||||||
|
|
||||||
|
|
||||||
FROM deps
|
FROM pynodedeps AS build
|
||||||
|
|
||||||
COPY --from=layer-cake / ./
|
COPY --from=layer-cake / ./
|
||||||
RUN doit
|
RUN doit
|
||||||
|
|
||||||
|
FROM pydeps
|
||||||
|
|
||||||
|
COPY --from=build /usr/src/app ./
|
||||||
|
|
||||||
ENV FLASK_APP=forget.py
|
ENV FLASK_APP=forget.py
|
||||||
|
|
||||||
VOLUME ["/var/run/celery"]
|
VOLUME ["/var/run/celery"]
|
||||||
|
|
Loading…
Reference in New Issue