rayyounghong/cpp-build-env-alpine

By rayyounghong

Updated about 1 hour ago

Dockerfile for cpp development.

Image
0

5.3K

rayyounghong/cpp-build-env-alpine repository overview

docker-cpp-build-env-alpine

A lightweight Alpine-based Docker image for C/C++ development, debugging, and CI builds, with vcpkg preinstalled.

Image: rayyounghong/cpp-build-env-alpine — built nightly for linux/amd64 and linux/arm64.

Features

  • Base: alpine:latest (small footprint, musl libc).
  • Toolchains: GCC (gcc, g++, build-base) and Clang (clang, lldb).
  • Build systems: make, ninja, cmake, autoconf, automake, libtool.
  • Debugging / profiling: gdb, lldb, strace, valgrind.
  • Package manager: vcpkg preinstalled at /home/builder/vcpkg, on PATH, with VCPKG_ROOT set. Bootstrapped with metrics disabled and VCPKG_FORCE_SYSTEM_BINARIES=1 (required on Alpine/musl).
  • Utilities: git, curl, tar, zip, unzip, rsync, dos2unix, bash.
  • Locale & time: tzdata + musl-locales, configured to en_US.UTF-8 / Etc/UTC.
  • Non-root user: runs as builder (uid from adduser -D) with /workspace as the working directory.
  • Multi-arch: published for linux/amd64 and linux/arm64.

Usage

Pull the image:

docker pull rayyounghong/cpp-build-env-alpine:latest

Drop into a shell with your project mounted at /workspace:

docker run --rm -it -v "$PWD":/workspace rayyounghong/cpp-build-env-alpine:latest bash

Use it as a CI build environment, e.g. in GitHub Actions:

jobs:
  build:
    runs-on: ubuntu-latest
    container: rayyounghong/cpp-build-env-alpine:latest
    steps:
      - uses: actions/checkout@v4
      - run: cmake -S . -B build -G Ninja
      - run: cmake --build build

Install dependencies with vcpkg (manifest mode):

vcpkg install

Notes

  • Compiling with vcpkg on Alpine requires VCPKG_FORCE_SYSTEM_BINARIES=1 (already set in the image) because vcpkg's prebuilt tool binaries are not musl-compatible.
  • The image is rebuilt nightly against alpine:latest, so latest follows upstream Alpine and vcpkg HEAD. Pin by digest if you need reproducible builds.

Tag summary

Content type

Image

Digest

sha256:5a743e21b

Size

463.5 MB

Last updated

about 1 hour ago

docker pull rayyounghong/cpp-build-env-alpine