-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
38 lines (27 loc) · 887 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Base
FROM python:3.11-slim-bookworm AS base
# build deps
RUN apt update && apt upgrade && apt install -y --no-install-recommends \
build-essential \
libpq-dev
# get latest version of pip
RUN pip install pip -U
# install requirements
COPY /requirements/* /app/requirements/
RUN pip install -r /app/requirements/dev.txt
# Final
FROM python:3.11-slim-bookworm AS final
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
RUN apt update && apt upgrade -y && apt install -y --no-install-recommends \
postgresql-client
# copy backend deps
COPY --from=BASE /usr/local/lib/python3.11 /usr/local/lib/python3.11
COPY --from=BASE /usr/local/bin/ /usr/local/bin/
COPY . /app
WORKDIR /app
# create user and drop privileges
RUN useradd -m nous_aggregator
RUN chown -R nous_aggregator /app
USER nous_aggregator
RUN python manage.py collectstatic --link --no-input