aboutsummaryrefslogtreecommitdiffstats
path: root/Dockerfile
blob: 20b099a0b0a9a31ce585215a024874c860e7c2b0 (plain) (blame)
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
FROM --platform=linux/amd64 python:3.10-slim

# Set pip to have no saved cache
ENV PIP_NO_CACHE_DIR=1 \
    PIP_DISABLE_PIP_VERSION_CHECK=on \
    POETRY_VERSION=1.1.15 \
    POETRY_HOME="/opt/poetry" \
    POETRY_VIRTUALENVS_IN_PROJECT=true \
    POETRY_NO_INTERACTION=1 \
    INSTALL_DIR="/opt/dependencies" \
    APP_DIR="/bot"

ENV PATH="$POETRY_HOME/bin:/$INSTALL_DIR/.venv/bin:$PATH"

RUN apt-get update \
  && apt-get -y upgrade \
  && apt-get install --no-install-recommends -y curl \
  && apt-get clean && rm -rf /var/lib/apt/lists/*

RUN curl -sSL https://install.python-poetry.org | python

# Install project dependencies
WORKDIR $INSTALL_DIR
COPY pyproject.toml poetry.lock ./
RUN poetry install --no-dev

# Define Git SHA build argument
ARG git_sha="development"

# Set Git SHA environment variable for Sentry
ENV GIT_SHA=$git_sha

# Copy the source code in last to optimize rebuilding the image
WORKDIR $APP_DIR
COPY . .

ENTRYPOINT ["python3"]
CMD ["-m", "bot"]