103 lines
3.7 KiB
Docker
103 lines
3.7 KiB
Docker
##
|
|
# 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
|
|
ENV GOPATH /go
|
|
ENV GOPROXY direct
|
|
ENV PATH /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/go/bin
|
|
|
|
# Fedora: Update all software and get dependencies.
|
|
# RUN dnf -y update
|
|
RUN dnf -y install git zip tar golang SDL2-devel SDL2_ttf-devel \
|
|
SDL2_mixer-devel mingw64-gcc make wget \
|
|
flatpak-builder ruby-devel gcc rpm-build libffi-devel
|
|
|
|
# Create a user to build the packages.
|
|
RUN useradd builder -u 1000 -m -G users && \
|
|
mkdir /go /git && chown -R builder:users /go /git
|
|
|
|
# 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/x86_64-w64-mingw32 /usr && \
|
|
cp -rv SDL2_mixer-2.0.4/x86_64-w64-mingw32 /usr && \
|
|
cp -rv SDL2_ttf-2.0.15/x86_64-w64-mingw32 /usr
|
|
RUN mkdir -p /usr/lib/golang/pkg/windows_amd64 && \
|
|
chown -R builder:users /usr/lib/golang/pkg/windows_amd64
|
|
|
|
# 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/levelpacks/levelpacks ./assets/levelpacks && \
|
|
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 dnf -y install ruby-devel gcc rpm-build libffi-devel
|
|
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 mingw-release
|
|
|
|
###
|
|
# Build the Flatpak release for Linux.
|
|
# RUN git clone https://code.sketchymaze.com/game/flatpak /git/flatpak
|
|
|
|
# # Fetch flatpak dependencies.
|
|
# RUN flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo && \
|
|
# flatpak install -y org.freedesktop.Sdk//21.08 && \
|
|
# flatpak install -y org.freedesktop.Sdk.Extension.golang//21.08
|
|
|
|
# # Path the go.mod `replace` directives to Flatpak's sandbox paths,
|
|
# # then build the Flatpak.
|
|
# RUN sed -i 's/=> \/git\/go\//=> \/run\/build\/sketchymaze\/deps\//g' go.mod && \
|
|
# cat go.mod
|
|
# WORKDIR /git/flatpak
|
|
# RUN make bundle; exit 0
|
|
# WORKDIR /go/src/git.kirsle.net/apps/doodle
|
|
|
|
CMD ["sudo", "cp", "-r", "-v", \
|
|
"/go/src/git.kirsle.net/apps/doodle/dist/release/", \
|
|
# "/git/flatpak/*.flatpak", \
|
|
"/mnt/export/"]
|