mirror of
https://github.com/danderson/netboot.git
synced 2025-10-15 09:31:29 +02:00
Refactor the dockerfile for Pixiecore.
The way docker hub and quay.io work, you can't easily pass a custom context to a Dockerfile. So, effectively, if you want multiple dockerfiles per repository, you need to re-check out the whole repository by hand, without help from the environment. This sucks a little bit because it doesn't guarantee that the build happens at the trigger revision ID, but for my purposes of "just have a recent build up", it's sufficient.
This commit is contained in:
parent
ec83c11ff0
commit
d759d198a9
9
Makefile
9
Makefile
@ -1,8 +1,11 @@
|
||||
.PHONY: none pixiecore-docker
|
||||
.PHONY: none pixiecore pixiecore-git
|
||||
|
||||
none:
|
||||
@echo "Use glide and the go tool for development"
|
||||
@echo "This makefile is just a shortcut for building docker containers."
|
||||
|
||||
pixiecore-docker:
|
||||
sudo docker build --rm -t danderson/pixiecore -f cmd/pixiecore/Dockerfile .
|
||||
pixiecore:
|
||||
sudo docker build --rm -t danderson/pixiecore -f dockerfiles/pixiecore/Dockerfile .
|
||||
|
||||
pixiecore-git:
|
||||
sudo docker build --rm -t danderson/pixiecore dockerfiles/pixiecore
|
||||
|
@ -1,21 +0,0 @@
|
||||
FROM alpine:edge
|
||||
MAINTAINER David Anderson <dave@natulte.net>
|
||||
|
||||
COPY . /tmp/go/src/go.universe.tf/netboot
|
||||
RUN \
|
||||
export GOPATH=/tmp/go &&\
|
||||
echo "http://dl-4.alpinelinux.org/alpine/edge/community" >>/etc/apk/repositories &&\
|
||||
apk -U add ca-certificates git go gcc musl-dev &&\
|
||||
apk upgrade &&\
|
||||
cd /tmp/go/src/go.universe.tf/netboot &&\
|
||||
ls -l &&\
|
||||
go get -v . &&\
|
||||
cd cmd/pixiecore &&\
|
||||
go build . &&\
|
||||
cp pixiecore /pixiecore &&\
|
||||
cd / &&\
|
||||
rm -rf /tmp/go &&\
|
||||
apk del git go gcc musl-dev &&\
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
ENTRYPOINT ["/pixiecore"]
|
7
dockerfiles/pixiecore/Dockerfile
Normal file
7
dockerfiles/pixiecore/Dockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
FROM alpine:edge
|
||||
MAINTAINER David Anderson <dave@natulte.net>
|
||||
|
||||
COPY . /tmp/stuff
|
||||
RUN cd /tmp/stuff; [ -f build.sh ] && ./build.sh || ./dockerfiles/pixiecore/build.sh
|
||||
|
||||
ENTRYPOINT ["/pixiecore"]
|
28
dockerfiles/pixiecore/build.sh
Executable file
28
dockerfiles/pixiecore/build.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
mkdir -p /tmp/go/src/go.universe.tf
|
||||
if [ -d /tmp/stuff/.git ]; then
|
||||
echo "Building from local dev copy"
|
||||
mkdir -p /tmp/go/src/go.universe.tf
|
||||
cp -R /tmp/stuff /tmp/go/src/go.universe.tf/netboot
|
||||
else
|
||||
echo "Building from git checkout"
|
||||
fi
|
||||
|
||||
export GOPATH=/tmp/go
|
||||
echo "http://dl-4.alpinelinux.org/alpine/edge/community" >>/etc/apk/repositories
|
||||
apk -U add ca-certificates git go gcc musl-dev
|
||||
apk upgrade
|
||||
go get -v github.com/Masterminds/glide
|
||||
go get -v -d go.universe.tf/netboot/cmd/pixiecore
|
||||
cd /tmp/go/src/go.universe.tf/netboot
|
||||
/tmp/go/bin/glide install
|
||||
cd cmd/pixiecore
|
||||
go build .
|
||||
cp ./pixiecore /pixiecore
|
||||
cd /
|
||||
apk del git go gcc musl-dev
|
||||
rm -rf /tmp/go /tmp/stuff /root/.glide /usr/lib/go /var/cache/apk/*
|
Loading…
x
Reference in New Issue
Block a user