Dockerfile updates

Noah 2020-11-27 13:45:21 -08:00
parent 5faa55ef85
commit d8397d102f
3 changed files with 31 additions and 11 deletions

View File

@ -2,12 +2,12 @@ SHELL := /bin/bash
.PHONY: clean .PHONY: clean
clean: clean:
sudo rm -rf ./dist rm -rf ./dist
sudo docker system prune -a podman system prune -a
.PHONY: mingw .PHONY: mingw
mingw: mingw:
mkdir -p ./dist/mingw mkdir -p ./dist/mingw
echo pwd is $(shell pwd) echo pwd is $(shell pwd)
sudo docker build -t doodle_mingw -f ./MinGW.dockerfile . podman 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 run --rm --mount type=bind,src=$(shell pwd)/dist/mingw,dst=/mnt/export doodle_mingw

View File

@ -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 FROM fedora:latest
MAINTAINER Noah Petherbridge <root@kirsle.net> MAINTAINER Noah Petherbridge <root@kirsle.net>
ENV GOPATH /go ENV GOPATH /go
ENV PATH /bin:/sbin:/usr/bin:/usr/sbin:/go/bin ENV PATH /bin:/sbin:/usr/bin:/usr/sbin:/go/bin
# Update all software and get dependencies. # Fedora: Update all software and get dependencies.
RUN dnf -y update # RUN dnf -y update
RUN dnf -y install git zip golang SDL2-devel SDL2_ttf-devel \ 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. # Create a user to build the packages.
RUN useradd builder -u 1000 -m -G users && \ 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-masters /git/masters
RUN git clone https://doodle:hiRN6wp-XPDBc@git.kirsle.net/apps/doodle /go/src/git.kirsle.net/apps/doodle 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. # Enter Doodle's directory.
WORKDIR /go/src/git.kirsle.net/apps/doodle 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. # Install Go dependencies and such.
RUN go get -u git.kirsle.net/go/bindata/... 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 && \ cp -r /git/masters/levels ./assets/levels && \
mkdir rtp && cp -r /git/rtp/* rtp/ mkdir rtp && cp -r /git/rtp/* rtp/
# RUN make doodads
# RUN make dist
# MinGW setup for Windows executable cross-compile. # MinGW setup for Windows executable cross-compile.
RUN dnf -y install mingw64-gcc
WORKDIR /git/vendor/mingw-libs WORKDIR /git/vendor/mingw-libs
RUN for i in *.tar.gz; do tar -xzvf $i; done RUN for i in *.tar.gz; do tar -xzvf $i; done
RUN cp -rv SDL2-2.0.9/x86_64-w64-mingw32 /usr && \ RUN cp -rv SDL2-2.0.9/x86_64-w64-mingw32 /usr && \

View File

@ -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 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. 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 make mingw
``` ```