From d8397d102f461a0fad30796523976c28e179634d Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Fri, 27 Nov 2020 13:45:21 -0800 Subject: [PATCH] Dockerfile updates --- Makefile | 8 ++++---- MinGW.dockerfile | 28 +++++++++++++++++++++------- README.md | 6 ++++++ 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index f8f22dc..52c7a94 100644 --- a/Makefile +++ b/Makefile @@ -2,12 +2,12 @@ SHELL := /bin/bash .PHONY: clean clean: - sudo rm -rf ./dist - sudo docker system prune -a + rm -rf ./dist + podman system prune -a .PHONY: mingw mingw: mkdir -p ./dist/mingw echo pwd is $(shell pwd) - sudo docker build -t doodle_mingw -f ./MinGW.dockerfile . - sudo docker run --rm --mount type=bind,src=$(shell pwd)/dist/mingw,dst=/mnt/export doodle_mingw + podman build -t doodle_mingw -f ./MinGW.dockerfile . + podman run --rm --mount type=bind,src=$(shell pwd)/dist/mingw,dst=/mnt/export doodle_mingw diff --git a/MinGW.dockerfile b/MinGW.dockerfile index eff738b..4d59c80 100644 --- a/MinGW.dockerfile +++ b/MinGW.dockerfile @@ -1,12 +1,21 @@ +## +# Fully build and distribute Linux and Windows binaries for Project: Doodle. +# +# Artifact outputs will be in the dist/mw/ folder. +# +# Windows binary cross-compiled with mingw from the Fedora +# docker container. +## + FROM fedora:latest MAINTAINER Noah Petherbridge ENV GOPATH /go ENV PATH /bin:/sbin:/usr/bin:/usr/sbin:/go/bin -# Update all software and get dependencies. -RUN dnf -y update +# Fedora: Update all software and get dependencies. +# RUN dnf -y update RUN dnf -y install git zip golang SDL2-devel SDL2_ttf-devel \ - SDL2_mixer-devel make + SDL2_mixer-devel mingw64-gcc make # Create a user to build the packages. RUN useradd builder -u 1000 -m -G users && \ @@ -21,8 +30,17 @@ RUN git clone https://doodle:hiRN6wp-XPDBc@git.kirsle.net/apps/doodle-vendor /gi RUN git clone https://doodle:hiRN6wp-XPDBc@git.kirsle.net/apps/doodle-masters /git/masters RUN git clone https://doodle:hiRN6wp-XPDBc@git.kirsle.net/apps/doodle /go/src/git.kirsle.net/apps/doodle +# Pre-download my Go render engine libraries +RUN git clone https://git.kirsle.net/go/ui /git/go/ui +RUN git clone https://git.kirsle.net/go/render /git/go/render +RUN git clone https://git.kirsle.net/go/audio /git/go/audio + # Enter Doodle's directory. WORKDIR /go/src/git.kirsle.net/apps/doodle +RUN echo "replace git.kirsle.net/go/ui => /git/go/ui" >> go.mod && \ + echo "replace git.kirsle.net/go/render => /git/go/render" && \ + echo "replace git.kirsle.net/go/audio => /git/go/audio" && \ + cat go.mod # Install Go dependencies and such. RUN go get -u git.kirsle.net/go/bindata/... @@ -34,11 +52,7 @@ RUN cp -r /git/vendor/fonts ./assets/fonts && \ cp -r /git/masters/levels ./assets/levels && \ mkdir rtp && cp -r /git/rtp/* rtp/ -# RUN make doodads -# RUN make dist - # MinGW setup for Windows executable cross-compile. -RUN dnf -y install mingw64-gcc WORKDIR /git/vendor/mingw-libs RUN for i in *.tar.gz; do tar -xzvf $i; done RUN cp -rv SDL2-2.0.9/x86_64-w64-mingw32 /usr && \ diff --git a/README.md b/README.md index e7957ca..5569c1c 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,12 @@ To ensure consistent builds of Project: Doodle, these Dockerfiles will set up a clean Linux environment and run all the steps to gather assets from all the git repos and build and release the app in a consistent way. +It uses the `podman` command, which is compatible with `docker` but doesn't +require elevated privileges. From a fresh Fedora environment, `dnf install podman` +and the makefile ought to "just work" (provided all the git repositories are +up and the heads are not broken). Also reading the Dockerfile can give you +an idea of the end-to-end process of the build. + ``` make mingw ```