Update Dockerfile
Browse files- Dockerfile +2 -20
Dockerfile
CHANGED
@@ -1,10 +1,7 @@
|
|
1 |
-
# Wybieramy oficjalny obraz Python jako bazowy
|
2 |
FROM python:3.11-slim AS base
|
3 |
|
4 |
-
# Ustawiamy katalog roboczy na /app
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
# Instalujemy zależności systemowe dla Playwright
|
8 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
9 |
wget \
|
10 |
unzip \
|
@@ -27,40 +24,25 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
27 |
libpango-1.0-0 \
|
28 |
libpangocairo-1.0-0 \
|
29 |
libx11-6 \
|
|
|
30 |
&& rm -rf /var/lib/apt/lists/*
|
31 |
|
32 |
-
# Kopiujemy pliki aplikacji do kontenera
|
33 |
COPY . /app/
|
34 |
|
35 |
-
# Instalujemy zależności z requirements.txt
|
36 |
RUN pip install --no-cache-dir -r requirements.txt
|
37 |
|
38 |
-
# Instalujemy przeglądarki Playwright (chromium)
|
39 |
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
40 |
RUN mkdir -p $PLAYWRIGHT_BROWSERS_PATH && playwright install chromium --with-deps
|
41 |
|
42 |
-
# Tworzymy użytkownika (bez roota)
|
43 |
RUN useradd -m -u 1000 user
|
44 |
-
|
45 |
-
# Tworzymy katalogi na dane
|
46 |
RUN mkdir /data
|
47 |
RUN chown -R 1000:1000 /app /data
|
48 |
|
49 |
-
# Kopiujemy plik entrypoint.sh do katalogu aplikacji
|
50 |
COPY entrypoint.sh /app/entrypoint.sh
|
51 |
-
|
52 |
-
# Nadajemy uprawnienia do entrypoint.sh przed przełączeniem użytkownika na "user"
|
53 |
RUN chmod +x /app/entrypoint.sh
|
54 |
|
55 |
-
# Przełączamy na użytkownika "user"
|
56 |
USER user
|
57 |
-
|
58 |
-
# Tworzymy zmienne środowiskowe
|
59 |
ENV HOME=/home/user \
|
60 |
PATH=/home/user/.local/bin:$PATH
|
61 |
|
62 |
-
|
63 |
-
RUN ls -l /app/entrypoint.sh
|
64 |
-
|
65 |
-
# Uruchomienie aplikacji Python (z pliku entrypoint.sh)
|
66 |
-
ENTRYPOINT ["/app/entrypoint.sh"]
|
|
|
|
|
1 |
FROM python:3.11-slim AS base
|
2 |
|
|
|
3 |
WORKDIR /app
|
4 |
|
|
|
5 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
6 |
wget \
|
7 |
unzip \
|
|
|
24 |
libpango-1.0-0 \
|
25 |
libpangocairo-1.0-0 \
|
26 |
libx11-6 \
|
27 |
+
xvfb \
|
28 |
&& rm -rf /var/lib/apt/lists/*
|
29 |
|
|
|
30 |
COPY . /app/
|
31 |
|
|
|
32 |
RUN pip install --no-cache-dir -r requirements.txt
|
33 |
|
|
|
34 |
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
35 |
RUN mkdir -p $PLAYWRIGHT_BROWSERS_PATH && playwright install chromium --with-deps
|
36 |
|
|
|
37 |
RUN useradd -m -u 1000 user
|
|
|
|
|
38 |
RUN mkdir /data
|
39 |
RUN chown -R 1000:1000 /app /data
|
40 |
|
|
|
41 |
COPY entrypoint.sh /app/entrypoint.sh
|
|
|
|
|
42 |
RUN chmod +x /app/entrypoint.sh
|
43 |
|
|
|
44 |
USER user
|
|
|
|
|
45 |
ENV HOME=/home/user \
|
46 |
PATH=/home/user/.local/bin:$PATH
|
47 |
|
48 |
+
ENTRYPOINT ["xvfb-run", "/app/entrypoint.sh"]
|
|
|
|
|
|
|
|