From f3e1fdd217b93e0d4c3268d587334c33ac0ba6fa Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Mon, 3 Jan 2022 21:03:31 -0800 Subject: [PATCH] Update the Dockerfiles --- 32bit.dockerfile | 11 +++++++---- 64bit.dockerfile | 30 +++++++++++++++++++++++++----- Makefile | 3 ++- README.md | 10 ++++++++++ 4 files changed, 44 insertions(+), 10 deletions(-) diff --git a/32bit.dockerfile b/32bit.dockerfile index 024ce47..9f4be85 100644 --- a/32bit.dockerfile +++ b/32bit.dockerfile @@ -10,13 +10,14 @@ FROM i386/debian:latest ENV GOPATH /go ENV GOPROXY direct -ENV PATH /opt/go/bin:/bin:/sbin:/usr/bin:/usr/sbin:/go/bin +ENV PATH /opt/go/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/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 + libsdl2-mixer-dev gcc-mingw-w64-i686 gcc make wget \ + flatpak-builder ruby-dev gcc rpm libffi-dev # Create a user to build the packages. RUN useradd builder -u 1000 -m -G users && \ @@ -69,7 +70,7 @@ RUN cp -r /git/vendor/fonts ./assets/fonts && \ mkdir rtp && cp -r /git/rtp/* rtp/ RUN ls -hal && pwd -RUN mkdir -p bin && cp /git/vendor/DLL/*.dll bin/ +RUN mkdir -p bin && cp /git/vendor/DLL-32bit/*.dll bin/ # Package rpm and deb for Linux. # TODO: fpm doesn't like to install in Docker right now @@ -86,4 +87,6 @@ RUN gem install fpm; exit 0 # zip them all up nicely. RUN make mingw32-release -CMD ["cp", "-r", "-v", "/go/src/git.kirsle.net/apps/doodle/dist/", "/mnt/export/"] +CMD ["cp", "-r", "-v", \ + "/go/src/git.kirsle.net/apps/doodle/dist/release/", \ + "/mnt/export/"] diff --git a/64bit.dockerfile b/64bit.dockerfile index a19d550..11b6e07 100644 --- a/64bit.dockerfile +++ b/64bit.dockerfile @@ -8,15 +8,15 @@ ## FROM fedora:latest -MAINTAINER Noah Petherbridge ENV GOPATH /go ENV GOPROXY direct -ENV PATH /bin:/sbin:/usr/bin:/usr/sbin:/go/bin +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 + 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 && \ @@ -67,7 +67,7 @@ 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 dnf -y install ruby-devel gcc rpm-build libffi-devel RUN gem install fpm; exit 0 # Run the big mingw-release, which: @@ -80,4 +80,24 @@ RUN gem install fpm; exit 0 # zip them all up nicely. RUN make mingw-release -CMD ["sudo", "cp", "-r", "-v", "/go/src/git.kirsle.net/apps/doodle/dist/", "/mnt/export/"] +### +# 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/"] diff --git a/Makefile b/Makefile index 50364d9..939d570 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ SHELL := /bin/bash # NOTE: # Fedora likes `podman` instead of `docker` but most other # distros (Debian, Manjaro) `docker` is easier to use. +# ln -s /usr/bin/podman ~/bin/docker .PHONY: clean clean: @@ -21,4 +22,4 @@ clean: mkdir -p ./dist/32bit echo pwd is $(shell pwd) docker build -t doodle_32bit -f ./32bit.dockerfile . - docker run --rm --mount type=bind,src=$(shell pwd)/dist/32bit,dst=/mnt/export doodle_32bit \ No newline at end of file + docker run --rm --mount type=bind,src=$(shell pwd)/dist/32bit,dst=/mnt/export doodle_32bit diff --git a/README.md b/README.md index 5569c1c..27ad7b6 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,16 @@ 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. +Run `make setup` to add flathub (--if-not-exists) and download the dependency +layers. + ``` make mingw ``` + +Podman tip: `podman system reset` to nuke all of it, cached images and build +steps, for a fresh start when testing the dockerfiles. + +**Fedora tip:** run `setenforce permissive` to disable SELinux for the +bind mount, or podman/docker can't copy artifacts from the Docker +container up to the host.