-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (39 loc) · 1.76 KB
/
Dockerfile
File metadata and controls
54 lines (39 loc) · 1.76 KB
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
54
# Stage 1: Build Python environment
FROM python:3.12-slim as builder
# Install uv, our package manager
RUN pip install uv
# Set up the working directory
WORKDIR /app
# Copy only the dependency definitions
COPY pyproject.toml uv.lock* ./
# Install dependencies using uv
# We use sync to ensure we use the locked versions
RUN uv sync
# ---
# Stage 2: Final runtime image
FROM python:3.12-slim
# Set up non-root user for security
RUN useradd --create-home appuser
WORKDIR /home/appuser
# Install Google Chrome and necessary dependencies
# Based on official Google Chrome for Linux repository
RUN apt-get update && apt-get install -y curl gnupg --no-install-recommends \
&& curl -sS https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/google-chrome-keyring.gpg \
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update \
&& apt-get install -y google-chrome-stable --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# Copy Python environment from the builder stage
COPY --from=builder /usr/local/lib/python3.12/site-packages/ /usr/local/lib/python3.12/site-packages/
# Copy all executables from the builder stage's bin directory (includes uv, honcho, etc.)
COPY --from=builder /usr/local/bin/ /usr/local/bin/
# Copy the rest of the application code
COPY . .
# Change ownership to the non-root user
RUN chown -R appuser:appuser /home/appuser
# Grant execute permissions to youtubeuploader
RUN chmod +x /home/appuser/youtubeuploader
# Switch to the non-root user
USER appuser
# Command to run the application using the project's runner 'uv run'
CMD ["uv", "run", "honcho", "start"]