BloodyInside commited on
Commit
c2f6a7b
·
1 Parent(s): aae91f6
Files changed (1) hide show
  1. Dockerfile +7 -60
Dockerfile CHANGED
@@ -52,70 +52,17 @@ RUN --mount=type=secret,id=HOST,required=true \
52
  --mount=type=secret,id=WORKER_TOKEN,required=true \
53
  --mount=type=secret,id=CLOUDFLARE_TURNSTILE_SECRET,required=true \
54
  --mount=type=secret,id=REDIS_URL,required=true \
55
- bash -c 'export HOST=$(cat /run/secrets/HOST) && \# syntax=docker/dockerfile:1.3
56
- ARG PYTHON_VERSION=3.12-slim-bullseye
57
-
58
- FROM python:${PYTHON_VERSION}
59
-
60
- ENV PYTHONDONTWRITEBYTECODE 1
61
- ENV PYTHONUNBUFFERED 1
62
-
63
- # Install dependencies
64
- RUN apt-get update && apt-get install -y \
65
- libpq-dev \
66
- gcc \
67
- g++ \
68
- wget \
69
- unzip \
70
- xvfb \
71
- libxi6 \
72
- libgconf-2-4 \
73
- gnupg \
74
- curl \
75
- && rm -rf /var/lib/apt/lists/*
76
-
77
- # Install Chrome
78
- RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
79
- && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
80
- && apt-get update \
81
- && apt-get install -y google-chrome-stable
82
 
83
- # Install ChromeDriver
84
- RUN CHROMEDRIVER_VERSION=$(curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE) \
85
- && wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip \
86
- && unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/
87
-
88
- RUN useradd -m -u 1000 user
89
- USER user
90
- ENV PATH="/home/user/.local/bin:$PATH"
91
-
92
- # Install Python dependencies
93
- COPY --chown=user requirements.txt /tmp/requirements.txt
94
- RUN pip install --no-cache-dir --upgrade pip \
95
- && pip install --no-cache-dir -r /tmp/requirements.txt
96
-
97
- # Copy application code
98
- COPY --chown=user . /code
99
- WORKDIR /code
100
-
101
- USER root
102
- # Use secrets during build
103
- RUN --mount=type=secret,id=HOST,required=true \
104
- --mount=type=secret,id=DJANGO_SECRET,required=true \
105
- --mount=type=secret,id=SECURE_TOKEN,required=true \
106
- --mount=type=secret,id=WORKER_TOKEN,required=true \
107
- --mount=type=secret,id=CLOUDFLARE_TURNSTILE_SECRET,required=true \
108
- --mount=type=secret,id=REDIS_URL,required=true
109
  RUN chown -R user:user /run/secrets
110
-
111
  USER user
112
 
113
- RUN bash -c 'export HOST=$(cat /run/secrets/HOST) && \
114
- export DJANGO_SECRET=$(cat /run/secrets/DJANGO_SECRET) && \
115
- export SECURE_TOKEN=$(cat /run/secrets/SECURE_TOKEN) && \
116
- export WORKER_TOKEN=$(cat /run/secrets/WORKER_TOKEN) && \
117
- export CLOUDFLARE_TURNSTILE_SECRET=$(cat /run/secrets/CLOUDFLARE_TURNSTILE_SECRET) && \
118
- export REDIS_URL=$(cat /run/secrets/REDIS_URL) && \
119
  python manage.py makemigrations && \
120
  python manage.py migrate --database=default && \
121
  python manage.py migrate --database=cache && \
 
52
  --mount=type=secret,id=WORKER_TOKEN,required=true \
53
  --mount=type=secret,id=CLOUDFLARE_TURNSTILE_SECRET,required=true \
54
  --mount=type=secret,id=REDIS_URL,required=true \
55
+ bash -c 'cp -r /run/secrets/* /secrets'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  RUN chown -R user:user /run/secrets
 
58
  USER user
59
 
60
+ RUN bash -c 'export HOST=$(cat /secrets/HOST) && \
61
+ export DJANGO_SECRET=$(cat /secrets/DJANGO_SECRET) && \
62
+ export SECURE_TOKEN=$(cat /secrets/SECURE_TOKEN) && \
63
+ export WORKER_TOKEN=$(cat /secrets/WORKER_TOKEN) && \
64
+ export CLOUDFLARE_TURNSTILE_SECRET=$(cat /secrets/CLOUDFLARE_TURNSTILE_SECRET) && \
65
+ export REDIS_URL=$(cat /secrets/REDIS_URL) && \
66
  python manage.py makemigrations && \
67
  python manage.py migrate --database=default && \
68
  python manage.py migrate --database=cache && \