Docker Build Scripts for Debian and Ubuntu
This commit is contained in:
parent
bca848d534
commit
92847fc3b7
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,6 +1,9 @@
|
|||
fonts/
|
||||
maps/
|
||||
bin/
|
||||
dist/
|
||||
docker/ubuntu
|
||||
docker/debian
|
||||
screenshot-*.png
|
||||
map-*.json
|
||||
pkg/wallpaper/*.png
|
||||
|
|
25
Makefile
25
Makefile
|
@ -1,6 +1,6 @@
|
|||
SHELL := /bin/bash
|
||||
|
||||
VERSION=$(shell grep -e 'Version' doodle.go | head -n 1 | cut -d '"' -f 2)
|
||||
VERSION=$(shell grep -e 'Version =' doodle.go | head -n 1 | cut -d '"' -f 2)
|
||||
BUILD=$(shell git describe --always)
|
||||
CURDIR=$(shell curdir)
|
||||
|
||||
|
@ -10,7 +10,7 @@ LDFLAGS := -ldflags "-X main.Build=$(BUILD)"
|
|||
# `make setup` to set up a new environment, pull dependencies, etc.
|
||||
.PHONY: setup
|
||||
setup: clean
|
||||
go get -u ./...
|
||||
go get ./...
|
||||
|
||||
# `make build` to build the binary.
|
||||
.PHONY: build
|
||||
|
@ -34,6 +34,27 @@ guitest:
|
|||
test:
|
||||
go test ./...
|
||||
|
||||
# `make dist` builds and tars up a release.
|
||||
.PHONY: dist
|
||||
dist: build
|
||||
mkdir -p dist/doodle-$(VERSION)
|
||||
cp bin/* dist/doodle-$(VERSION)/
|
||||
cp -r assets fonts README.md Changes.md dist/doodle-$(VERSION)/
|
||||
cd dist && tar -czvf doodle-$(VERSION).tar.gz doodle-$(VERSION)
|
||||
cd dist && zip -r doodle-$(VERSION).zip doodle-$(VERSION)
|
||||
|
||||
# `make docker` to run the Docker builds
|
||||
.PHONY: docker docker.ubuntu docker.debian __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.dist: dist
|
||||
cp dist/*.tar.gz dist/*.zip /mnt/export/
|
||||
|
||||
# `make clean` cleans everything up.
|
||||
.PHONY: clean
|
||||
clean:
|
||||
|
|
23
docker/Debian.dockerfile
Normal file
23
docker/Debian.dockerfile
Normal file
|
@ -0,0 +1,23 @@
|
|||
FROM debian: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 && \
|
||||
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
|
||||
|
||||
# Add the project to the GOPATH
|
||||
ADD . /home/builder/go/src/git.kirsle.net/apps/doodle
|
||||
RUN chown -R builder:builder /home/builder/go
|
||||
|
||||
# Build the app
|
||||
USER builder
|
||||
WORKDIR /home/builder/go/src/git.kirsle.net/apps/doodle
|
||||
RUN make setup
|
||||
RUN make dist
|
||||
CMD ["make", "__docker.dist"]
|
23
docker/Ubuntu.dockerfile
Normal file
23
docker/Ubuntu.dockerfile
Normal file
|
@ -0,0 +1,23 @@
|
|||
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 && \
|
||||
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
|
||||
|
||||
# Add the project to the GOPATH
|
||||
ADD . /home/builder/go/src/git.kirsle.net/apps/doodle
|
||||
RUN chown -R builder:builder /home/builder/go
|
||||
|
||||
# Build the app
|
||||
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-debian.sh
Executable file
10
docker/dist-debian.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Run this script from the root of the repo.
|
||||
if [[ ! -f "./docker/dist-debian.sh" ]]; then
|
||||
echo "Run this script from the root of the doodle repo, i.e.: ./docker/dist-debian.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo docker build -t doodle_debian -f ./docker/Debian.dockerfile .
|
||||
sudo docker run --rm -v "$(pwd)/docker/debian:/mnt/export:z" doodle_debian
|
10
docker/dist-ubuntu.sh
Executable file
10
docker/dist-ubuntu.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Run this script from the root of the repo.
|
||||
if [[ ! -f "./docker/dist-ubuntu.sh" ]]; then
|
||||
echo "Run this script from the root of the doodle repo, i.e.: ./docker/dist-ubuntu.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo docker build -t doodle_ubuntu -f ./docker/Ubuntu.dockerfile .
|
||||
sudo docker run --rm -v "$(pwd)/docker/ubuntu:/mnt/export:z" doodle_ubuntu
|
|
@ -28,7 +28,7 @@ func TestWallpaper(t *testing.T) {
|
|||
img := image.NewRGBA(image.Rect(0, 0, width, height))
|
||||
draw.Draw(
|
||||
// Corner: red
|
||||
img, // dst Image
|
||||
img, // dst Image
|
||||
image.Rect(0, 0, qWidth, qHeight), // r Rectangle
|
||||
image.NewUniform(red), // src Image
|
||||
image.Point{0, 0}, // sp Point
|
||||
|
|
Loading…
Reference in New Issue
Block a user