From b559efb4aaa4f27c14c727204d18bfc217e86e7c Mon Sep 17 00:00:00 2001 From: xbazzi Date: Wed, 5 Feb 2025 22:32:30 -0700 Subject: [PATCH] Add Dockerfile for building the runtime image --- Dockerfile-for-building-the-runtime-image.md | 81 ++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Dockerfile-for-building-the-runtime-image.md diff --git a/Dockerfile-for-building-the-runtime-image.md b/Dockerfile-for-building-the-runtime-image.md new file mode 100644 index 0000000..fff4b7e --- /dev/null +++ b/Dockerfile-for-building-the-runtime-image.md @@ -0,0 +1,81 @@ +``` +# Use the official golang:1.22.12-bookworm image as the build stage +FROM golang:1.22.12-bookworm + +# Create a directory /app +RUN mkdir /app + +# Set the working directory to /app +WORKDIR /app + +# Copy the current directory contents into /app +COPY ./ /app/ + +# Update the package list and install necessary packages +RUN apt-get update && apt-get install -y --no-install-recommends \ + curl \ + wget \ + vim \ + git \ + debconf \ + ca-certificates \ + tar \ + autoconf \ + automake \ + build-essential \ + cmake \ + git-core \ + libass-dev \ + libfreetype6-dev \ + libgnutls28-dev \ + libmp3lame-dev \ + libsdl2-dev \ + libtool \ + libva-dev \ + libvdpau-dev \ + libvorbis-dev \ + libxcb1-dev \ + libxcb-shm0-dev \ + libxcb-xfixes0-dev \ + meson \ + ninja-build \ + pkg-config \ + texinfo \ + yasm \ + zlib1g-dev \ + libx264-dev \ + libx265-dev \ + libnuma-dev \ + libvpx-dev \ + libopus-dev \ + libunistring-dev \ + libaom-dev \ + libdav1d-dev && \ + # Download Go module dependencies + go mod download && \ + # Download yt-dlp + wget --no-check-certificate -c https://github.com/yt-dlp/yt-dlp/releases/download/2025.01.26/yt-dlp_linux &&\ + # Download ffmpeg + wget --no-check-certificate -c https://www.johnvansickle.com/ffmpeg/old-releases/ffmpeg-6.0.1-amd64-static.tar.xz &&\ + # Move yt-dlp to /usr/bin and set permissions + mv yt-dlp_linux /usr/bin/yt-dlp && \ + chmod 755 /usr/bin/yt-dlp && \ + chmod +x /usr/bin/yt-dlp && \ + # Extract ffmpeg tarball + tar -xf ffmpeg-6.0.1-amd64-static.tar.xz && \ + # Remove the tarball + rm -rf ffmpeg-6.0.1-amd64-static.tar.xz && \ + # Set execute permissions for ffmpeg and ffprobe + chmod +x ffmpeg-6.0.1-amd64-static/ffmpeg && \ + chmod +x ffmpeg-6.0.1-amd64-static/ffprobe && \ + # Copy ffmpeg and ffprobe to /usr/bin + cp -R ffmpeg-6.0.1-amd64-static/ffmpeg /usr/bin/ && \ + cp -R ffmpeg-6.0.1-amd64-static/ffprobe /usr/bin/ && \ + # Remove the extracted ffmpeg directory + rm -rf ffmpeg-6.0.1-amd64-static && \ + # Create a new user 'papibot' + useradd papibot && \ + # Build the Go application + CGO_ENABLED=0 GOOS=linux go build -o /app/papibot + +``` \ No newline at end of file