-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
52 lines (40 loc) · 1.24 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
FROM python:3.13-slim-bookworm
# Install system dependencies
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y sqlite3 curl --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man \
&& apt-get clean
# install s5cmd
COPY --from=peakcom/s5cmd:latest /s5cmd /usr/local/bin/s5cmd
# install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# - Silence uv complaining about not being able to use hard links,
# - tell uv to byte-compile packages for faster application startups,
# - prevent uv from accidentally downloading isolated Python builds,
# - pick a Python,
ENV UV_LINK_MODE=copy \
UV_COMPILE_BYTECODE=1 \
UV_PYTHON_DOWNLOADS=never \
UV_PYTHON=python3.13
# Create directory for the datatbase
RUN mkdir -p /app/db
# Add the backup script
COPY backup.sh /app/
# Add the entrypoint script
COPY entrypoint.sh /app/
# Set up the environment
COPY pyproject.toml /app/
COPY uv.lock /app/
WORKDIR /app
RUN uv sync --locked --no-dev
# Copy the rest of the application
COPY . /app
RUN mkdir /app/staticfiles
RUN chmod +x /app/backup.sh
RUN chmod +x /app/entrypoint.sh
# Switching to a non-root user
RUN useradd appuser && chown -R appuser /app
USER appuser
# Expose the port
EXPOSE 8000