-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
86 lines (75 loc) · 2.87 KB
/
Dockerfile
File metadata and controls
86 lines (75 loc) · 2.87 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
FROM python:3.14-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
curl \
&& rm -rf /var/lib/apt/lists/*
# Build and install diff-pdf from source
RUN apt-get update && apt-get install -y --no-install-recommends \
automake \
autoconf \
g++ \
make \
pkg-config \
git \
libpoppler-glib-dev \
libwxgtk3.2-dev \
xvfb \
xauth \
&& git clone --depth=1 https://github.com/vslavik/diff-pdf.git /tmp/diff-pdf \
&& cd /tmp/diff-pdf \
&& ./bootstrap \
&& ./configure \
&& make \
&& make install \
&& mv /usr/local/bin/diff-pdf /usr/local/bin/diff-pdf-bin \
&& printf '#!/bin/sh\nexec xvfb-run -a diff-pdf-bin "$@"\n' > /usr/local/bin/diff-pdf \
&& chmod +x /usr/local/bin/diff-pdf \
&& rm -rf /tmp/diff-pdf \
&& apt-get purge -y automake autoconf g++ make pkg-config git \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Download and install fonts
RUN apt-get update && apt-get install -y unzip && \
mkdir -p /app/app/web/static/fonts /tmp/fonts && \
cd /tmp/fonts && \
# # Download Roboto (replaced by Inter)
# curl -L -o roboto.zip "https://github.com/googlefonts/roboto-3-classic/releases/download/v3.011/Roboto_v3.011.zip" && \
# unzip -q roboto.zip && \
# cp unhinted/static/Roboto-Regular.ttf /app/app/web/static/fonts/ && \
# cp unhinted/static/Roboto-Medium.ttf /app/app/web/static/fonts/ && \
# cp unhinted/static/Roboto-Bold.ttf /app/app/web/static/fonts/ && \
# Download Inter (variable font)
curl -L -o inter.zip "https://github.com/rsms/inter/releases/download/v4.1/Inter-4.1.zip" && \
unzip -q inter.zip && \
find /tmp/fonts -name 'InterVariable.woff2' ! -name '*Italic*' -exec cp {} /app/app/web/static/fonts/ \; && \
find /tmp/fonts -name 'InterVariable-Italic.woff2' -exec cp {} /app/app/web/static/fonts/ \; && \
# Download RobotoMono
curl -L -o robotomono.zip "https://github.com/googlefonts/RobotoMono/archive/refs/tags/v3.001.zip" && \
unzip -q robotomono.zip && \
cp RobotoMono-3.001/fonts/ttf/RobotoMono-Regular.ttf /app/app/web/static/fonts/ && \
cp RobotoMono-3.001/fonts/ttf/RobotoMono-Medium.ttf /app/app/web/static/fonts/ && \
cp RobotoMono-3.001/fonts/ttf/RobotoMono-Bold.ttf /app/app/web/static/fonts/ && \
# Cleanup
cd /app && \
rm -rf /tmp/fonts && \
apt-get remove -y unzip && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
# Make entrypoint executable
RUN chmod +x docker-entrypoint.sh
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV DB_FILE=/data/eclass.db
# Expose port
EXPOSE 8000
# Run the application
ENTRYPOINT ["./docker-entrypoint.sh"]