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/
|
fonts/
|
||||||
maps/
|
maps/
|
||||||
bin/
|
bin/
|
||||||
|
dist/
|
||||||
|
docker/ubuntu
|
||||||
|
docker/debian
|
||||||
screenshot-*.png
|
screenshot-*.png
|
||||||
map-*.json
|
map-*.json
|
||||||
pkg/wallpaper/*.png
|
pkg/wallpaper/*.png
|
||||||
|
|
25
Makefile
25
Makefile
|
@ -1,6 +1,6 @@
|
||||||
SHELL := /bin/bash
|
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)
|
BUILD=$(shell git describe --always)
|
||||||
CURDIR=$(shell curdir)
|
CURDIR=$(shell curdir)
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ LDFLAGS := -ldflags "-X main.Build=$(BUILD)"
|
||||||
# `make setup` to set up a new environment, pull dependencies, etc.
|
# `make setup` to set up a new environment, pull dependencies, etc.
|
||||||
.PHONY: setup
|
.PHONY: setup
|
||||||
setup: clean
|
setup: clean
|
||||||
go get -u ./...
|
go get ./...
|
||||||
|
|
||||||
# `make build` to build the binary.
|
# `make build` to build the binary.
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
|
@ -34,6 +34,27 @@ guitest:
|
||||||
test:
|
test:
|
||||||
go 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.
|
# `make clean` cleans everything up.
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
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
|
Loading…
Reference in New Issue
Block a user