From 5faa55ef8535d30e28977d12091706cd62d4bcd8 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Fri, 5 Jun 2020 01:00:54 -0700 Subject: [PATCH] Initial commit --- .gitignore | 1 + Makefile | 13 ++++++++++ MinGW.dockerfile | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 9 +++++++ 4 files changed, 87 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 MinGW.dockerfile create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b6fa190 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +ssh/* diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f8f22dc --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +SHELL := /bin/bash + +.PHONY: clean +clean: + sudo rm -rf ./dist + sudo docker 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 diff --git a/MinGW.dockerfile b/MinGW.dockerfile new file mode 100644 index 0000000..eff738b --- /dev/null +++ b/MinGW.dockerfile @@ -0,0 +1,64 @@ +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 +RUN dnf -y install git zip golang SDL2-devel SDL2_ttf-devel \ + SDL2_mixer-devel make + +# 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 + +# Enter Doodle's directory. +WORKDIR /go/src/git.kirsle.net/apps/doodle + +# Install Go dependencies and such. +RUN go get -u git.kirsle.net/go/bindata/... +RUN make bindata-dev +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 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 && \ + 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 +WORKDIR /go/src/git.kirsle.net/apps/doodle + +RUN make mingw +RUN cp /git/vendor/DLL/*.dll bin/ + +RUN make dist + +# 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 +# WORKDIR /go/src/git.kirsle.net/apps/doodle/dist/doodle-latest +# RUN pwd +# RUN ../../scripts/fpm-bundle.sh + +CMD ["sudo", "cp", "-r", "-v", "/go/src/git.kirsle.net/apps/doodle/dist/", "/mnt/export/"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..e7957ca --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Dockerfiles for Project: Doodle + +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. + +``` +make mingw +```