Fedora Dockerfile for building

This commit is contained in:
Noah 2019-04-05 13:16:33 -07:00
parent 92847fc3b7
commit 569e67bf9e
8 changed files with 81 additions and 15 deletions

1
.gitignore vendored
View File

@ -4,6 +4,7 @@ bin/
dist/
docker/ubuntu
docker/debian
docker/fedora
screenshot-*.png
map-*.json
pkg/wallpaper/*.png

34
Building.md Normal file
View File

@ -0,0 +1,34 @@
# Building Doodle
Makefile commands for Linux:
* `make setup`: install Go dependencies and set up the build environment
* `make build`: build the Doodle and Doodad binaries to the `bin/` folder.
* `make run`: run a local dev build of Doodle in debug mode
* `make guitest`: run a local dev build in the GUITest scene
* `make test`: run the test suite
* `make dist`: produce a zipped release tarball and zip file for your current
environment and output into the `dist/` folder.
* `make docker`: run all the Dockerfiles from the `docker/` folder to produce
dist builds for Debian, Fedora and Ubuntu. You may also run these builds
individually:
* `make docker.ubuntu`
* `make docker.debian`
* `make docker.fedora`
* `make clean`: clean all build artifacts
## Linux
Dependencies are Go, SDL2 and SDL2_ttf:
```bash
# Fedora
sudo dnf -y install golang SDL2-devel SDL2_ttf-devel
# Ubuntu and Debian
sudo apt -y install golang libsdl2-dev libsdl2-ttf-dev
```
## Windows
TBD.

View File

@ -44,18 +44,21 @@ dist: build
cd dist && zip -r doodle-$(VERSION).zip doodle-$(VERSION)
# `make docker` to run the Docker builds
.PHONY: docker docker.ubuntu docker.debian __docker.dist
.PHONY: docker docker.ubuntu docker.debian docker.fedora __docker.dist
docker.ubuntu:
mkdir -p docker/ubuntu
./docker/dist-ubuntu.sh
docker.debian:
mkdir -p docker/debian
./docker/dist-debian.sh
docker: docker.ubuntu docker.debian
docker.fedora:
mkdir -p docker/fedora
./docker/dist-fedora.sh
docker: docker.ubuntu docker.debian docker.fedora
__docker.dist: dist
cp dist/*.tar.gz dist/*.zip /mnt/export/
# `make clean` cleans everything up.
.PHONY: clean
clean:
rm -rf bin dist
rm -rf bin dist docker/ubuntu docker/debian docker/fedora

View File

@ -8,8 +8,7 @@ RUN apt update && apt -y upgrade && \
apt clean
# Create a user to build the packages.
RUN useradd builder -u 1000 -m -G users && \
echo "builder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
RUN useradd builder -u 1000 -m -G users
# Add the project to the GOPATH
ADD . /home/builder/go/src/git.kirsle.net/apps/doodle
@ -19,5 +18,4 @@ RUN chown -R builder:builder /home/builder/go
USER builder
WORKDIR /home/builder/go/src/git.kirsle.net/apps/doodle
RUN make setup
RUN make dist
CMD ["make", "__docker.dist"]

21
docker/Fedora.dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM fedora:latest
MAINTAINER Noah Petherbridge <root@kirsle.net>
ENV GOPATH /home/builder/go
# Update all the software and then install Go, git, SDL2 and other dependencies
RUN dnf -y update && \
dnf -y install git zip golang SDL2-devel SDL2_ttf-devel make && \
dnf clean all
# Create a user to build the packages.
RUN useradd builder -u 1000 -m -G users
# Add the project to the GOPATH
ADD . /home/builder/go/src/git.kirsle.net/apps/doodle
WORKDIR /home/builder/go/src/git.kirsle.net/apps/doodle
RUN chown -R builder:builder /home/builder/go
# Build the app as the `builder` user
USER builder
RUN make setup
CMD ["make", "__docker.dist"]

View File

@ -2,22 +2,21 @@ FROM ubuntu:latest
MAINTAINER Noah Petherbridge <root@kirsle.net>
ENV GOPATH /home/builder/go
RUN apt update && apt -y upgrade && \
apt -y install git zip golang \
libsdl2-dev libsdl2-ttf-dev make && \
# Update all the software and then install Go, git, SDL2 and other dependencies
RUN apt update && \
apt -y upgrade && \
apt -y install git zip golang libsdl2-dev libsdl2-ttf-dev make && \
apt clean
# Create a user to build the packages.
RUN useradd builder -u 1000 -m -G users && \
echo "builder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
RUN useradd builder -u 1000 -m -G users
# Add the project to the GOPATH
ADD . /home/builder/go/src/git.kirsle.net/apps/doodle
WORKDIR /home/builder/go/src/git.kirsle.net/apps/doodle
RUN chown -R builder:builder /home/builder/go
# Build the app
# Build the app as the `builder` user
USER builder
WORKDIR /home/builder/go/src/git.kirsle.net/apps/doodle
RUN make setup
RUN make dist
CMD ["make", "__docker.dist"]

10
docker/dist-fedora.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
# Run this script from the root of the repo.
if [[ ! -f "./docker/dist-fedora.sh" ]]; then
echo "Run this script from the root of the doodle repo, i.e.: ./docker/dist-fedora.sh"
exit 1
fi
sudo docker build -t doodle_fedora -f ./docker/Fedora.dockerfile .
sudo docker run --rm -v "$(pwd)/docker/fedora:/mnt/export:z" doodle_fedora

View File

@ -44,7 +44,7 @@ func TestPointInside(t *testing.T) {
W: 490,
},
p: render.NewPoint(509, 260),
shouldPass: true,
shouldPass: false,
},
}