-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
49 lines (36 loc) · 1.29 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
FROM python:3.11-alpine AS builder
RUN apk update \
&& apk upgrade \
&& apk add --no-cache --virtual .build-deps \
ca-certificates gcc postgresql-dev linux-headers musl-dev \
libffi-dev zlib-dev git bash curl build-base
WORKDIR /app
ENV VIRTUAL_ENV=/opt/venv
RUN python -m venv "$VIRTUAL_ENV"
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY requirements.txt /app/requirements.txt
RUN pip install --upgrade pip --no-cache-dir
RUN pip install -r requirements.txt
FROM python:3.11-alpine
LABEL org.label-schema.schema-version="1.0"
LABEL org.label-schema.name="Stubborn"
LABEL org.label-schema.vendor="[email protected]"
LABEL org.label-schema.vcs-url="https://github.com/s-nagaev/stubborn"
ENV VIRTUAL_ENV=/opt/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN apk update \
&& apk upgrade \
&& apk add --no-cache --no-cache mailcap libpq-dev make
COPY --from=builder /opt/venv /opt/venv
COPY --from=builder /usr/local/bin /usr/local/bin
WORKDIR /app
COPY . .
RUN ln -f .env.test /app/stubborn/settings/.env
RUN python manage.py collectstatic --no-input
RUN rm /app/stubborn/settings/.env
RUN addgroup -S django && adduser -S django -G django
USER django
EXPOSE 8000
HEALTHCHECK --interval=20s --timeout=3s --start-period=30s CMD python scripts/healthcheck.py || exit 1
ENTRYPOINT []
CMD make run