89 lines
3.2 KiB
Plaintext
89 lines
3.2 KiB
Plaintext
|
##
|
||
|
# 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 i386/debian:latest
|
||
|
ENV GOPATH /go
|
||
|
ENV GOPROXY direct
|
||
|
ENV PATH /opt/go/bin:/bin:/sbin:/usr/bin:/usr/sbin:/go/bin
|
||
|
|
||
|
# Debian: Update all software and get dependencies.
|
||
|
# RUN dnf -y update
|
||
|
RUN apt update && apt -y upgrade && apt -y dist-upgrade
|
||
|
RUN apt -y install git zip tar libsdl2-dev libsdl2-ttf-dev \
|
||
|
libsdl2-mixer-dev gcc-mingw-w64-i686 gcc make wget
|
||
|
|
||
|
# Create a user to build the packages.
|
||
|
RUN useradd builder -u 1000 -m -G users && \
|
||
|
mkdir /go /git && chown -R builder:users /go /git
|
||
|
|
||
|
# Download and install modern Go.
|
||
|
WORKDIR /root
|
||
|
RUN wget https://golang.org/dl/go1.17.1.linux-386.tar.gz -O go.tgz && \
|
||
|
tar -xzvf go.tgz && \
|
||
|
cp -r go /opt/go
|
||
|
|
||
|
# Docker cache invalidation here.
|
||
|
# ADD . /home/builder
|
||
|
|
||
|
# Git clone all the repos. XXX: passwords exposed here
|
||
|
RUN git clone https://doodle:hiRN6wp-XPDBc@git.kirsle.net/apps/doodle-rtp /git/rtp
|
||
|
RUN git clone https://doodle:hiRN6wp-XPDBc@git.kirsle.net/apps/doodle-vendor /git/vendor
|
||
|
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
|
||
|
|
||
|
# MinGW setup for Windows executable cross-compile.
|
||
|
WORKDIR /git/vendor/mingw-libs
|
||
|
RUN for i in *.tar.gz; do tar -xzvf $i; done
|
||
|
RUN cp -rv SDL2-2.0.9/i686-w64-mingw32 /usr && \
|
||
|
cp -rv SDL2_mixer-2.0.4/i686-w64-mingw32 /usr && \
|
||
|
cp -rv SDL2_ttf-2.0.15/i686-w64-mingw32 /usr
|
||
|
RUN mkdir -p /usr/lib/golang/pkg/windows_386 && \
|
||
|
chown -R builder:users /usr/lib/golang/pkg/windows_386
|
||
|
|
||
|
# 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, patch the go.mod and fetch the guidebook.
|
||
|
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" >> go.mod && \
|
||
|
echo "replace git.kirsle.net/go/audio => /git/go/audio" >> go.mod && \
|
||
|
cat go.mod && \
|
||
|
wget -O - https://download.sketchymaze.com/guidebook.tar.gz | tar -xzvf -
|
||
|
|
||
|
# Install Go dependencies and such.
|
||
|
RUN make setup
|
||
|
|
||
|
# Copy default vendored assets in.
|
||
|
RUN cp -r /git/vendor/fonts ./assets/fonts && \
|
||
|
cp -r /git/masters/levels ./assets/levels && \
|
||
|
mkdir rtp && cp -r /git/rtp/* rtp/
|
||
|
|
||
|
RUN ls -hal && pwd
|
||
|
RUN mkdir -p bin && cp /git/vendor/DLL/*.dll bin/
|
||
|
|
||
|
# Package rpm and deb for Linux.
|
||
|
# TODO: fpm doesn't like to install in Docker right now
|
||
|
RUN apt -y install ruby-dev ruby-rubygems rpm libffi-dev
|
||
|
RUN gem install fpm; exit 0
|
||
|
|
||
|
# Run the big mingw-release, which:
|
||
|
# - builds the doodads
|
||
|
# - embeds the bindata files
|
||
|
# - builds the program for Linux
|
||
|
# - builds for Windows via MinGW
|
||
|
# - runs `make dist/` creating an uber build for both OS's
|
||
|
# - runs release.sh to carve out the Linux and Windows versions and
|
||
|
# zip them all up nicely.
|
||
|
RUN make mingw32-release
|
||
|
|
||
|
CMD ["cp", "-r", "-v", "/go/src/git.kirsle.net/apps/doodle/dist/", "/mnt/export/"]
|