-
Notifications
You must be signed in to change notification settings - Fork 11
/
build-docker.sh
executable file
·38 lines (30 loc) · 1.02 KB
/
build-docker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
set -eux
VERSION=$(grep "^version:" pid1.cabal | cut -d " " -f14)
LAST_LINE=$(stack sdist --ignore-check 2>&1 | tail -n 1)
SDIST=${LAST_LINE##* }
rm -rf build-docker
mkdir build-docker
mkdir -p build-home
docker run --rm \
-v "$(pwd)"/build-docker:/host-bin \
-v "$SDIST":/sdist.tar.gz \
-v "$(pwd)"/build-home:/home/build \
fpco/alpine-haskell-stack:9.2.5 \
/bin/bash -c \
'chown $(id -u) $HOME && rm -rf $HOME/pid1-* && tar zxfv /sdist.tar.gz && cd pid1-* && stack install --system-ghc --flag pid1:static --local-bin-path /host-bin'
cat > build-docker/Dockerfile <<EOF
FROM ubuntu:22.04
MAINTAINER Michael Snoyman ([email protected])
ADD pid1 /sbin/pid1
ENTRYPOINT ["/sbin/pid1", "--RTS"]
EOF
docker build --tag fpco/pid1:22.04 build-docker
# Sanity check
docker run --rm fpco/pid1:22.04 ps
# Push
docker tag fpco/pid1:22.04 fpco/pid1:22.04
docker tag fpco/pid1:22.04 fpco/pid1:"${VERSION}"
docker push fpco/pid1:22.04
docker push fpco/pid1:"${VERSION}"
docker push fpco/pid1:latest