reorganize dockerfile for better build cache usage
also lock some versions ideally I wouldn't have to copy each of these directories separately and have a janky stage to hide all the resulting layers, but docker do be like that. `COPY dir1 dir2 ./` copies *the contents of* dir1 and dir2 to the working directory :( maybe one day i will switch to having a src directory
This commit is contained in:
parent
59095ae1ef
commit
fddcbbe8a0
30
Dockerfile
30
Dockerfile
|
@ -1,14 +1,32 @@
|
|||
FROM python:3 AS builder
|
||||
FROM python:3.10-bullseye AS deps
|
||||
WORKDIR /usr/src/app
|
||||
COPY . .
|
||||
|
||||
# install python stuff
|
||||
RUN python -m pip install --upgrade pip
|
||||
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
|
||||
|
||||
# build assets
|
||||
RUN apt-get update -qq && apt-get install -qq nodejs npm
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm install --save-dev
|
||||
|
||||
|
||||
FROM scratch AS layer-cake
|
||||
WORKDIR /
|
||||
|
||||
COPY *.py setup.cfg rollup.config.js ./
|
||||
COPY assets assets
|
||||
COPY components components
|
||||
COPY libforget libforget
|
||||
COPY migrations migrations
|
||||
COPY routes routes
|
||||
COPY static static
|
||||
COPY templates templates
|
||||
|
||||
|
||||
FROM deps
|
||||
|
||||
COPY --from=layer-cake / ./
|
||||
RUN doit
|
||||
|
||||
VOLUME ["/var/run/celery"]
|
||||
|
|
Loading…
Reference in New Issue