Skip to content

Instantly share code, notes, and snippets.

@Cyberax
Last active December 25, 2025 21:15
Show Gist options
  • Select an option

  • Save Cyberax/61e6b419cd338ae7c3a7c7098abec137 to your computer and use it in GitHub Desktop.

Select an option

Save Cyberax/61e6b419cd338ae7c3a7c7098abec137 to your computer and use it in GitHub Desktop.
# syntax=docker/dockerfile:1.7-labs
# The base dockerfile, used for all the services and build tools.
# It contains runtimes for Python, NodeJs, and Go compiler along with usual debug tools.
# We start with the nodejs-based image, as Node is the biggest package to install.
FROM node:24-trixie
ENV DEBIAN_FRONTEND=noninteractive
RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
--mount=target=/var/cache/apt,type=cache,sharing=locked \
<<EOF
set -euo pipefail
# Install the essential packages
apt-get update
apt-get -y --no-install-recommends install bash curl wget ca-certificates git vim-nox \
rsync net-tools telnet git strace jq yq unzip
# Docker, useful for building
apt-get install -y --no-install-recommends docker.io docker-compose
# Add CVML-related software
apt-get install -y --no-install-recommends python3 python3-dev python3-pip ffmpeg gdal-bin libgdal-dev # libsm6 libxext6
# Install the Postgres 18 (through its repository)
install -d /usr/share/postgresql-common/pgdg
curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
. /etc/os-release
sh -c "echo 'deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $VERSION_CODENAME-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
apt update && apt-get -y --no-install-recommends install postgresql-client
EOF
# Add Go, the Delve debugger, and the Taskfile runner
RUN --mount=type=cache,target=/root/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
<<EOF
set -euo pipefail
case `uname -m` in
aarch64) goarch=arm64 ;;
x86_64) goarch=amd64 ;;
*) echo "Unknown architecture"; exit 1 ;;
esac
if [ ! -f /root/.cache/go-build/go-installer.tgz ]; then
# TODO: vendor through git-lfs
curl -L https://go.dev/dl/go1.25.5.linux-${goarch}.tar.gz -o /root/.cache/go-build/go-installer.tgz
fi
tar xzf /root/.cache/go-build/go-installer.tgz -C /usr/local
export PATH=$PATH:/usr/local/go/bin
# TODO: install using the "tools" pattern
go install github.com/go-delve/delve/cmd/dlv@v1.25.2;
go install github.com/go-task/task/v3/cmd/task@v3.45.5
# Make golangci-lint available for reproducing CI runs
# TODO: install using the "tools" pattern
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
| sh -s -- -b $(go env GOPATH)/bin v2.6.2
EOF
# Install the UV package manager. TODO: vendor through git-lfs, or to Cargo, needs more recent Rust
# cargo install --locked uv@0.9.16
RUN curl -LsSf https://astral.sh/uv/0.9.16/install.sh | sh
COPY collector-agent.yaml /
# Install the OpenTelemetry. TODO: vendor through git-lfs
RUN <<EOF
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.130.1/otelcol-contrib_0.130.1_linux_amd64.tar.gz
tar xzf otelcol-contrib_0.130.1_linux_amd64.tar.gz
rm /README.md /otelcol-contrib_0.130.1_linux_amd64.tar.gz
EOF
# Add the local paths for UV, go, and others
ENV PATH=/root/.local/bin:/usr/local/go/bin:/root/go/bin:$PATH
FROM base AS proto-build
COPY anyfile /app/
RUN --mount=type=cache,target=/tmp/wget <<EOF
echo "Hello, world"
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment