-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.prod
41 lines (28 loc) · 985 Bytes
/
Dockerfile.prod
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
FROM python:3.11-bullseye AS base
ENV DEBIAN_FRONTEND noninteractive
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV POETRY_VERSION 1.7.1
ENV VERSION $VERSION
ARG PORT
WORKDIR /tmp
COPY poetry.lock pyproject.toml ./
SHELL [ "/bin/bash", "-o", "pipefail", "-c" ]
RUN apt-get update && apt-get install --no-install-recommends -y supervisor && \
mkdir -p /var/log/supervisor && \
pip install --no-cache-dir "poetry==$POETRY_VERSION" && \
poetry export --without-hashes -f requirements.txt | pip install --no-cache-dir -r /dev/stdin && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR /bot
COPY ./bot/ ./bot/
COPY ./kvisualbot/ ./kvisualbot/
COPY ./*.py ./
COPY ./*.sh ./
COPY supervisord.conf ./
RUN python manage.py collectstatic --noinput
EXPOSE $PORT
FROM base AS api
ENTRYPOINT [ "/bin/sh", "-c", "gunicorn --config /bot/gunicorn.conf.py --pid /tmp/gunicorn" ]
FROM base AS bot
ENTRYPOINT [ "/bin/sh", "-c", "python main.py runbot" ]