-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
48 lines (36 loc) · 1.32 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
# Use an official Python runtime as a parent image
FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV POETRY_VERSION 1.8.3
ENV REQUESTS_CA_BUNDLE "/etc/ssl/certs/ca-certificates.crt"
ENV CURL_CA_BUNDLE "/etc/ssl/certs/ca-certificates.crt"
# install basic dependencies
RUN apt-get update && \
apt-get install --fix-broken --no-install-recommends -y \
git ffmpeg libsm6 libxext6 poppler-utils libmagic-mgc libmagic1 && \
apt-get autoremove -y && apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Create a non-root user
RUN adduser --disabled-password --gecos '' appuser
# Set work directory
WORKDIR /home/appuser
ENV PYTHONPATH /home/appuser
# Install Poetry
RUN pip install --upgrade pip && \
pip install "poetry==$POETRY_VERSION"
# Copy only the files needed for installing dependencies
COPY pyproject.toml poetry.lock ./
# Install project dependencies
RUN poetry config virtualenvs.create false && \
poetry install --no-cache --no-plugins --no-interaction --no-ansi
# Copy the rest of the application's code
COPY --chmod=777 entrypoint /entrypoint
COPY . .
# Expose port 8000 to the outside once the container has launched
EXPOSE 8000
STOPSIGNAL SIGQUIT
RUN chown -R appuser:appuser /home/appuser
# Run the application
ENTRYPOINT ["/bin/bash", "/entrypoint"]