diff --git a/Dockerfile b/Dockerfile index 353dfb3..228d4fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,18 @@ # HOW TO USE THIS DOCKERFILE # -# 1. build image and tag it as ff7-build:latest -# docker build --tag ff7-build:latest . +# 1. Build image (one time): +# docker build --platform=linux/amd64 --tag ff7-build:latest . # -# 2. launch container and mount current directory under /ff7 -# docker run --name ff7-work -it -v $(pwd):/ff7 -v ff7_venv:/ff7/.venv -v ff7_build:/ff7/build ff7-build +# 2. Run builds using the wrapper script (recommended): +# ./tools/docker-build.sh "make build" +# ./tools/docker-build.sh "make format" +# ./tools/docker-build.sh bash # interactive shell # -# 3. you are now ready to build and work on FF7 -# make expected -# -# 4. from now on, to re-use the same container execute the following: -# docker start -ai ff7-work +# 3. Or run interactively and reuse the container: +# docker run --name ff7-work -it --platform=linux/amd64 \ +# -v $(pwd):/ff7 -v ff7_venv:/ff7/.venv -v ff7_build:/ff7/build \ +# -v go_cache:/gocache ff7-build +# # Then reattach with: docker start -ai ff7-work FROM ubuntu:noble @@ -27,6 +29,10 @@ RUN echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ questing main unive COPY --from=golang:1.25-bookworm /usr/local/go/ /usr/local/go/ ENV PATH="${PATH}:/usr/local/go/bin" +ENV GOMODCACHE=/gocache/mod +ENV GOCACHE=/gocache/build + +RUN mkdir -p /gocache/mod /gocache/build && chmod -R 777 /gocache USER ubuntu WORKDIR /ff7 diff --git a/tools/docker-build.sh b/tools/docker-build.sh new file mode 100755 index 0000000..119e21b --- /dev/null +++ b/tools/docker-build.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Optimized Docker build wrapper for FF7 decomp +# Uses Docker volumes for Go caching (faster on macOS than host mounts) + +set -e + +# Run Docker with volume mounts for source, venv, build output, and Go cache +exec docker run --rm --platform=linux/amd64 \ + --name ff7-work \ + -v "$(pwd)":/ff7 \ + -v ff7_venv:/ff7/.venv \ + -v ff7_build:/ff7/build \ + -v go_cache:/gocache \ + ff7-build:latest -lc "cd /ff7 && $*"