-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
53 lines (39 loc) · 1.05 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
50
51
52
53
# ----- python-base ----- #
FROM python:3.10.11-slim-bullseye AS python-base
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
PIP_ROOT_USER_ACTION=ignore \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_NO_INTERACTION=1
# ----- builder-base ----- #
FROM python-base AS builder-base
RUN pip install --upgrade pip && pip install poetry==1.5.0
WORKDIR /app
COPY poetry.lock pyproject.toml ./
RUN poetry install --without dev
# ----- runtime ----- #
FROM python-base AS runtime
ARG DB_HOST
ARG DB_PORT
ARG DB_NAME
ARG DB_USER
ARG DB_PASSWORD
ARG SLACK_TOKEN
ARG SLACK_CHANNEL
ENV DB_HOST=$DB_HOST \
DB_PORT=$DB_PORT \
DB_NAME=$DB_NAME \
DB_USER=$DB_USER \
DB_PASSWORD=$DB_PASSWORD \
SLACK_TOKEN=$SLACK_TOKEN \
SLACK_CHANNEL=$SLACK_CHANNEL \
VENV_PATH="/app/.venv"
ENV PATH="$VENV_PATH/bin:$PATH"
COPY --from=builder-base $VENV_PATH $VENV_PATH
WORKDIR /app
COPY . .
CMD ["python", "handler.py"]