-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (47 loc) · 1.44 KB
/
Dockerfile
File metadata and controls
60 lines (47 loc) · 1.44 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
FROM golang:1.22-bullseye as builder
WORKDIR /app
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy source code
COPY . .
# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -o reader cmd/reader/main.go
FROM debian:bullseye-slim
# Install Chromium and dependencies
RUN apt-get update && \
apt-get install -y \
chromium \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst \
fonts-symbola \
fonts-noto \
fonts-freefont-ttf \
curl \
ca-certificates \
dbus \
xvfb \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& which chromium || (echo "Chromium not found" && exit 1)
WORKDIR /app
# Copy the binary from builder
COPY --from=builder /app/reader .
# Create directory for config and ensure proper permissions
RUN mkdir -p /app/config && \
mkdir -p /tmp/.X11-unix && \
chmod 1777 /tmp/.X11-unix && \
ln -s /usr/bin/chromium /usr/bin/chromium-browser
# Set environment variables
ENV PATH="/app:${PATH}"
ENV CHROME_PATH="/usr/bin/chromium"
ENV DISPLAY=":99"
# Chrome flags for containerized environment
ENV CHROMIUM_FLAGS="--no-sandbox,--disable-dev-shm-usage,--disable-gpu,--headless,--disable-software-rasterizer,--disable-setuid-sandbox,--no-zygote,--single-process,--disable-extensions"
# Expose port
EXPOSE 4444
# Start Xvfb and the application
CMD Xvfb :99 -screen 0 1024x768x16 & ./reader run