|
1 | 1 | # Setup base |
2 | 2 | FROM golang:1.24.5 AS base |
3 | | -WORKDIR /app |
4 | | -COPY ./go.mod ./ |
5 | | -COPY ./go.sum ./ |
6 | | -RUN go mod download |
7 | | -COPY cmd/ ./cmd/ |
8 | | -COPY twitch/ ./twitch/ |
9 | | -COPY utils/ ./utils/ |
| 3 | + WORKDIR /app |
| 4 | + COPY ./go.mod ./ |
| 5 | + COPY ./go.sum ./ |
| 6 | + RUN go mod download |
| 7 | + COPY cmd/ ./cmd/ |
| 8 | + COPY twitch/ ./twitch/ |
| 9 | + COPY utils/ ./utils/ |
10 | 10 |
|
11 | 11 | # Setup builder |
12 | 12 | FROM base AS builder |
13 | | -RUN go build -o /stream ./cmd/main.go |
| 13 | + RUN go build -o /stream ./cmd/main.go |
14 | 14 |
|
15 | | -# Download Chrome |
| 15 | +# Download Chrome in a separate stage so it's done parallel to the rest of the build |
16 | 16 | FROM curlimages/curl:latest AS downloader |
17 | | -RUN curl -fsSL https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ |
18 | | - -o google-chrome-stable_current_amd64.deb |
| 17 | + RUN curl -fsSL https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ |
| 18 | + -o google-chrome-stable_current_amd64.deb |
19 | 19 |
|
20 | 20 | # Run using FFmpeg image with Chrome support |
21 | 21 | FROM linuxserver/ffmpeg:7.1.1 AS runner |
22 | | - |
23 | | -# Install runtime dependencies |
24 | | -RUN apt-get update && apt-get install -y \ |
25 | | - xvfb \ |
26 | | - x11-utils \ |
27 | | - pulseaudio \ |
28 | | - pulseaudio-utils \ |
29 | | - alsa-utils \ |
30 | | - libasound2-plugins \ |
31 | | - dbus \ |
32 | | - && rm -rf /var/lib/apt/lists/* |
33 | | - |
34 | | -# Install Chrome from downloaded .deb |
35 | | -COPY --from=downloader /home/curl_user/google-chrome-stable_current_amd64.deb /tmp/google-chrome-stable_current_amd64.deb |
36 | | -RUN apt-get update \ |
37 | | - && apt-get install -y /tmp/google-chrome-stable_current_amd64.deb \ |
38 | | - && rm /tmp/google-chrome-stable_current_amd64.deb \ |
39 | | - && rm -rf /var/lib/apt/lists/* |
40 | | - |
41 | | -# Create directories for audio configs |
42 | | -RUN mkdir -p /root/.config/pulse /var/run/pulse /var/run/dbus |
43 | | - |
44 | | -# Copy startup script |
45 | | -COPY start.sh /start.sh |
46 | | -RUN chmod +x /start.sh |
47 | | - |
48 | | -# Copy app binary |
49 | | -COPY --from=builder /stream /stream |
50 | | - |
51 | | -# Set environment variables (DISPLAY will be set dynamically in start.sh) |
52 | | -ENV PULSE_RUNTIME_PATH=/var/run/pulse |
53 | | - |
54 | | -ENTRYPOINT ["/start.sh"] |
| 22 | + # Install runtime dependencies |
| 23 | + RUN apt-get update && apt-get install -y \ |
| 24 | + xvfb \ |
| 25 | + x11-utils \ |
| 26 | + pulseaudio \ |
| 27 | + pulseaudio-utils \ |
| 28 | + alsa-utils \ |
| 29 | + libasound2-plugins \ |
| 30 | + dbus \ |
| 31 | + && rm -rf /var/lib/apt/lists/* |
| 32 | + |
| 33 | + # Install Chrome from downloaded .deb |
| 34 | + COPY --from=downloader /home/curl_user/google-chrome-stable_current_amd64.deb /tmp/google-chrome-stable_current_amd64.deb |
| 35 | + RUN apt-get update \ |
| 36 | + && apt-get install -y /tmp/google-chrome-stable_current_amd64.deb \ |
| 37 | + && rm /tmp/google-chrome-stable_current_amd64.deb \ |
| 38 | + && rm -rf /var/lib/apt/lists/* |
| 39 | + |
| 40 | + # Create directories for audio configs |
| 41 | + RUN mkdir -p /root/.config/pulse /var/run/pulse /var/run/dbus |
| 42 | + |
| 43 | + # Copy startup script |
| 44 | + COPY start.sh /start.sh |
| 45 | + RUN chmod +x /start.sh |
| 46 | + |
| 47 | + # Copy app binary |
| 48 | + COPY --from=builder /stream /stream |
| 49 | + |
| 50 | + # Set environment variables (DISPLAY will be set dynamically in start.sh) |
| 51 | + ENV PULSE_RUNTIME_PATH=/var/run/pulse |
| 52 | + |
| 53 | + ENTRYPOINT ["/start.sh"] |
0 commit comments