Skip to content

Commit c7344fb

Browse files
committed
Update Dockerfile
1 parent 88e3ace commit c7344fb

File tree

1 file changed

+42
-41
lines changed

1 file changed

+42
-41
lines changed

Dockerfile

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,44 @@
1-
FROM ubuntu:22.04
2-
3-
# Ubuntu no longer distributes chromium-browser outside of snap
4-
#
5-
# Proposed solution: https://askubuntu.com/questions/1204571/how-to-install-chromium-without-snap
6-
7-
# Add debian buster
8-
RUN echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/debian-buster.gpg] http://deb.debian.org/debian buster main\n\
9-
deb [arch=amd64 signed-by=/usr/share/keyrings/debian-buster-updates.gpg] http://deb.debian.org/debian buster-updates main\n\
10-
deb [arch=amd64 signed-by=/usr/share/keyrings/debian-security-buster.gpg] http://deb.debian.org/debian-security buster/updates main\n'\
11-
>> /etc/apt/sources.list.d/debian.list
12-
13-
# Add keys
14-
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DCC9EFBF77E11517 \
15-
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \
16-
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 112695A0E562B32A \
17-
&& apt-key export 77E11517 | gpg --dearmour -o /usr/share/keyrings/debian-buster.gpg \
18-
&& apt-key export 22F3D138 | gpg --dearmour -o /usr/share/keyrings/debian-buster-updates.gpg \
19-
&& apt-key export E562B32A | gpg --dearmour -o /usr/share/keyrings/debian-security-buster.gpg
20-
21-
# Prefer debian repo for chromium* packages only
22-
# Note the double-blank lines between entries
23-
RUN <<EOF cat >> /etc/apt/preferences.d/chromium.pref
24-
RUN echo 'Package: *\n\
25-
Pin: release a=eoan\n\
26-
Pin-Priority: 500\n\
27-
\n\
28-
\n\
29-
Package: *\n\
30-
Pin: origin "deb.debian.org"\n\
31-
Pin-Priority: 300\n\
32-
\n\
33-
\n\
34-
Package: chromium*\n\
35-
Pin: origin "deb.debian.org"\n\
36-
Pin-Priority: 700\n'\
37-
>> /etc/apt/preferences.d/chromium.pref
38-
39-
RUN apt-get install -y chromium chromium-drive
40-
41-
RUN pip3 install -r requirements.txt
1+
# Use official Python 3.11 slim image
2+
FROM python:3.11-slim
423

4+
# Set environment variables
5+
ENV PYTHONUNBUFFERED=1 \
6+
PYTHONDONTWRITEBYTECODE=1 \
7+
PIP_NO_CACHE_DIR=1 \
8+
DEBIAN_FRONTEND=noninteractive
9+
10+
# Install system dependencies
11+
RUN apt-get update && apt-get install -y \
12+
wget \
13+
gnupg \
14+
curl \
15+
unzip \
16+
&& apt-get clean \
17+
&& rm -rf /var/lib/apt/lists/*
18+
19+
# Install Google Chrome
20+
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/googlechrome-linux-keyring.gpg \
21+
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/googlechrome-linux-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list \
22+
&& apt-get update \
23+
&& apt-get install -y google-chrome-stable \
24+
&& apt-get clean \
25+
&& rm -rf /var/lib/apt/lists/*
26+
27+
# Install uv
28+
RUN pip install uv
29+
30+
# Set working directory
31+
WORKDIR /app
32+
33+
# Copy pyproject.toml and install dependencies
34+
COPY pyproject.toml ./
35+
RUN uv pip install --system -e .
36+
37+
# Copy source code
4338
COPY . .
39+
40+
# Expose port (if running web service)
41+
EXPOSE 8000
42+
43+
# Default command
44+
CMD ["python", "-c", "from piedomains.api import DomainClassifier; print('piedomains v0.4.0 ready!')"]

0 commit comments

Comments
 (0)