-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
35 lines (27 loc) · 892 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
# Initial image
# Note: bookworm breaks for some reason, maybe incompatibility with it's
# seccomp setup and certain versions of docker?
# So we use bullseye instead.
# FROM python:3.11-slim-bookworm
FROM python:3.11-slim-bullseye
# Set local username
ENV USERNAME=appuser
# Set up non-root user and work directory
RUN useradd --create-home "$USERNAME"
WORKDIR /home/"$USERNAME"
USER "$USERNAME"
# Create and activate virtualenv
ENV VIRTUAL_ENV=/home/"$USERNAME"/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# upgrade pip in virtualenv
RUN python -m pip install --upgrade pip
# Install requirements
COPY requirements.txt /tmp/
RUN pip install -r /tmp/requirements.txt
# Copy application files
COPY --chown="$USERNAME":"$USERNAME" . ./app
# Install application
RUN pip install --no-deps ./app
# Start application
CMD ["python", "-m", "pytexbot"]