feat: add Docker build environment

Ubuntu 24.04 container with ARM cross-compilation toolchain for
building the ROM without host toolchain setup. Includes Makefile
targets for docker-build, docker-shell, and docker-clean.

Co-Authored-By: Claude
This commit is contained in:
Gregory Markou (ai) 2026-04-06 23:46:45 +09:00
parent 30185ea16b
commit 7d8c2b8ff6
No known key found for this signature in database
5 changed files with 81 additions and 0 deletions

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
.git
.gitignore
Dockerfile
docker-compose.yml
build/**

30
DOCKER.md Normal file
View File

@ -0,0 +1,30 @@
# Docker
Build pokeemerald without installing the toolchain on your host machine.
## Prerequisites
- [Docker](https://docs.docker.com/get-docker/) with Compose v2
## Usage
```bash
# Build the ROM
make docker-build
# Open a shell inside the container
make docker-shell
# Clean build artifacts
make docker-clean
```
The output ROM is written to `pokeemerald_modern.gba` in the project root.
## How it works
The container is an Ubuntu 24.04 image with the ARM cross-compilation toolchain (`gcc-arm-none-eabi`, `binutils-arm-none-eabi`) and build dependencies pre-installed. Your project directory is volume-mounted into the container at `/workspace`, so source edits on the host are immediately reflected.
The build uses `MODERN=1`, which compiles with the system `arm-none-eabi-gcc` rather than the legacy `agbcc` compiler. A persistent Docker volume caches `ccache` data across builds to speed up recompilation.
On first run, Docker will build the image - subsequent runs reuse the cached image.

21
Dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
ENV PATH="/usr/lib/ccache:${PATH}"
RUN apt-get update && apt-get install -y \
build-essential \
binutils-arm-none-eabi \
gcc-arm-none-eabi \
git \
make \
python3 \
ccache \
libpng-dev \
&& rm -rf /var/lib/apt/lists/*
ENV CCACHE_DIR=/ccache
WORKDIR /workspace
CMD ["bash"]

View File

@ -389,3 +389,15 @@ $(ROM): $(ELF)
# Symbol file (`make syms`)
$(SYM): $(ELF)
$(OBJDUMP) -t $< | sort -u | grep -E "^0[2389]" | $(PERL) -p -e 's/^(\w{8}) (\w).{6} \S+\t(\w{8}) (\S+)$$/\1 \2 \3 \4/g' > $@
# Docker
.PHONY: docker-build docker-shell docker-clean
docker-build:
HOST_UID=$$(id -u) HOST_GID=$$(id -g) docker compose run --rm pokeemerald
docker-shell:
HOST_UID=$$(id -u) HOST_GID=$$(id -g) docker compose run --rm pokeemerald bash
docker-clean:
HOST_UID=$$(id -u) HOST_GID=$$(id -g) docker compose run --rm pokeemerald make clean

13
docker-compose.yml Normal file
View File

@ -0,0 +1,13 @@
services:
pokeemerald:
build: .
working_dir: /workspace
environment:
CCACHE_DIR: /ccache
volumes:
- ./:/workspace
- pokeemerald_ccache:/ccache
command: bash -lc "make clean-tools && make MODERN=1 -j$$(nproc)"
volumes:
pokeemerald_ccache: