mirror of
https://github.com/commercialhaskell/stackage.git
synced 2026-01-11 23:08:30 +01:00
Modify docker build script
This commit is contained in:
parent
d6b16c49a9
commit
0f114e0414
@ -145,6 +145,15 @@ docker run $ARGS_UPLOAD $IMAGE /bin/bash -c "curator upload-docs --target $TARGE
|
|||||||
|
|
||||||
docker run $ARGS_UPLOAD $IMAGE curator legacy-bulk --stackage-snapshots /dot-stackage/curator/stackage-snapshots/ --lts-haskell /dot-stackage/curator/lts-haskell/ --stackage-nightly /dot-stackage/curator/stackage-nightly/
|
docker run $ARGS_UPLOAD $IMAGE curator legacy-bulk --stackage-snapshots /dot-stackage/curator/stackage-snapshots/ --lts-haskell /dot-stackage/curator/lts-haskell/ --stackage-nightly /dot-stackage/curator/stackage-nightly/
|
||||||
|
|
||||||
|
# Build and push docker image fpco/stack-build & fpco/stack-build-small for current release
|
||||||
|
|
||||||
|
if [ $SHORTNAME = "lts" ]
|
||||||
|
then
|
||||||
|
$ROOT/dockerfiles/build.sh $TARGET
|
||||||
|
$ROOT/dockerfiles/build.sh --push $TARGET
|
||||||
|
$ROOT/dockerfiles/build.sh --push --small $TARGET
|
||||||
|
fi
|
||||||
|
|
||||||
(
|
(
|
||||||
if [ $SHORTNAME = "lts" ]
|
if [ $SHORTNAME = "lts" ]
|
||||||
then
|
then
|
||||||
|
|||||||
@ -8,7 +8,7 @@ images. This script and its Dockerfiles are used for building images for LTS >=
|
|||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
|
||||||
./build.sh [--push] [--dry-run] [--small] lts-X.Y|lts-X|lts]"
|
./build.sh [--push] [--dry-run] [--small] lts-X.Y"
|
||||||
|
|
||||||
Options
|
Options
|
||||||
-------
|
-------
|
||||||
@ -25,10 +25,7 @@ Options
|
|||||||
Argument
|
Argument
|
||||||
---------
|
---------
|
||||||
|
|
||||||
If you specify and exact LTS version, that image will be built. If you only
|
The image for the selected LTS version will be built.
|
||||||
specify the major version, then an image for the latest minor version for that
|
|
||||||
major version will be built. If you specify 'lts', an image for the latest LTS
|
|
||||||
snapshot is built.
|
|
||||||
|
|
||||||
This searches for a Dockerfile for the selected snapshot in
|
This searches for a Dockerfile for the selected snapshot in
|
||||||
`lts-X.Y/Dockerfile`, and if one isn't found reuses the same image as built the
|
`lts-X.Y/Dockerfile`, and if one isn't found reuses the same image as built the
|
||||||
|
|||||||
@ -21,7 +21,7 @@ VARIANT=build
|
|||||||
usage() {
|
usage() {
|
||||||
echo "$0: $1" >&2
|
echo "$0: $1" >&2
|
||||||
echo
|
echo
|
||||||
echo "Usage: $0 [--push] [--dry-run] [--small] lts-X.Y|lts-X|lts]"
|
echo "Usage: $0 [--push] [--dry-run] [--small] lts-X.Y]"
|
||||||
echo "See README.md for more information."
|
echo "See README.md for more information."
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
@ -77,27 +77,16 @@ while [[ $# -gt 0 ]]; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
#
|
|
||||||
# Determine actual snapshot version from aliases
|
|
||||||
#
|
|
||||||
|
|
||||||
SNAPSHOTS="$(mktemp "lts-snapshots.json.XXXXXX")"
|
|
||||||
trap "rm -f \"$SNAPSHOTS\"" EXIT
|
|
||||||
wget -qO- https://www.stackage.org/download/lts-snapshots.json >"$SNAPSHOTS"
|
|
||||||
|
|
||||||
case "$LTS_SLUG_ARG" in
|
case "$LTS_SLUG_ARG" in
|
||||||
"")
|
"")
|
||||||
usage "Missing argument: snapshot or alias"
|
usage "Missing argument: snapshot"
|
||||||
;;
|
;;
|
||||||
lts-*.*)
|
lts-*.*)
|
||||||
LTS_SLUG="$LTS_SLUG_ARG"
|
LTS_SLUG="$LTS_SLUG_ARG"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
LTS_SLUG=$(jq -r ".[\"$LTS_SLUG_ARG\"]" "$SNAPSHOTS")
|
echo "$0: Wrong snapshot format: $LTS_SLUG_ARG" >&2
|
||||||
if [[ -z "$LTS_SLUG" || "$LTS_SLUG" = "null" ]]; then
|
exit 1
|
||||||
echo "$0: Cannot find LTS version for slug: $LTS_SLUG_ARG" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -105,24 +94,6 @@ LTS_VERSION="${LTS_SLUG#lts-}"
|
|||||||
LTS_MAJOR="${LTS_VERSION%.*}"
|
LTS_MAJOR="${LTS_VERSION%.*}"
|
||||||
LTS_MINOR="${LTS_VERSION#*.}"
|
LTS_MINOR="${LTS_VERSION#*.}"
|
||||||
|
|
||||||
#
|
|
||||||
# Determine latest LTS version
|
|
||||||
#
|
|
||||||
|
|
||||||
LATEST_LTS_SLUG=$(jq -r ".[\"lts\"]" $SNAPSHOTS)
|
|
||||||
LATEST_LTS_VERSION="${LATEST_LTS_SLUG#lts-}"
|
|
||||||
LATEST_LTS_MAJOR="${LATEST_LTS_VERSION%.*}"
|
|
||||||
LATEST_LTS_MINOR="${LATEST_LTS_VERSION#*.}"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Determine latest minor version of the selected major version
|
|
||||||
#
|
|
||||||
|
|
||||||
MAJOR_LATEST_LTS_SLUG=$(jq -r ".[\"lts-$LTS_MAJOR\"]" $SNAPSHOTS)
|
|
||||||
MAJOR_LATEST_LTS_VERSION="${MAJOR_LATEST_LTS_SLUG#lts-}"
|
|
||||||
MAJOR_LATEST_LTS_MAJOR="${MAJOR_LATEST_LTS_VERSION%.*}"
|
|
||||||
MAJOR_LATEST_LTS_MINOR="${MAJOR_LATEST_LTS_VERSION#*.}"
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Find the Dockerfile for the selected snapshot
|
# Find the Dockerfile for the selected snapshot
|
||||||
#
|
#
|
||||||
@ -157,14 +128,9 @@ fi
|
|||||||
# Create and push additional tags
|
# Create and push additional tags
|
||||||
#
|
#
|
||||||
|
|
||||||
# If we select the latest minor version for the selected major version, then
|
# Create and push an 'lts-X' tag.
|
||||||
# also create and push an 'lts-X' tag.
|
tagpush "$DOCKER_REPO:$LTS_SLUG" "$DOCKER_REPO:lts-$LTS_MAJOR"
|
||||||
if [[ "$MAJOR_LATEST_LTS_VERSION" = "$LTS_VERSION" ]]; then
|
|
||||||
tagpush "$DOCKER_REPO:$LTS_SLUG" "$DOCKER_REPO:lts-$LTS_MAJOR"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If we selected the latest LTS snapshot, also create and push the 'lts' and 'latest' tags.
|
# Create and push the 'lts' and 'latest' tags.
|
||||||
if [[ "$LATEST_LTS_VERSION" = "$LTS_VERSION" ]]; then
|
tagpush "$DOCKER_REPO:$LTS_SLUG" "$DOCKER_REPO:lts"
|
||||||
tagpush "$DOCKER_REPO:$LTS_SLUG" "$DOCKER_REPO:lts"
|
tagpush "$DOCKER_REPO:$LTS_SLUG" "$DOCKER_REPO:latest"
|
||||||
tagpush "$DOCKER_REPO:$LTS_SLUG" "$DOCKER_REPO:latest"
|
|
||||||
fi
|
|
||||||
|
|||||||
89
automated/dockerfiles/lts-14.0/Dockerfile.sub
Normal file
89
automated/dockerfiles/lts-14.0/Dockerfile.sub
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
FROM ubuntu:18.04
|
||||||
|
|
||||||
|
LABEL maintainer="manny@fpcomplete.com"
|
||||||
|
|
||||||
|
ARG GHC_VERSION=8.6.5
|
||||||
|
ARG LTS_SLUG=lts-14.0
|
||||||
|
ARG PID1_VERSION=0.1.2.0
|
||||||
|
ARG STACK_VERSION=2.1.3
|
||||||
|
ARG CUDA_VERSION=10.0
|
||||||
|
ARG JVM_PATH=/usr/lib/jvm/java-8-openjdk-amd64
|
||||||
|
ARG LLVM_VERSION=3.9
|
||||||
|
ARG BOOTSTRAP_COMMIT=d4143f1845f26e8e99d0a1a8134d6ff535ab98b2
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
ARG VARIANT=build
|
||||||
|
ARG STACK_ROOT=/home/stackage/.stack
|
||||||
|
|
||||||
|
#
|
||||||
|
# Set encoding to UTF-8 and PATH to find GHC and cabal/stack-installed binaries.
|
||||||
|
#
|
||||||
|
|
||||||
|
ENV LANG=C.UTF-8 \
|
||||||
|
LC_ALL=C.UTF-8 \
|
||||||
|
PATH=/root/.local/bin:/usr/local/cuda-$CUDA_VERSION/bin:$STACK_ROOT/programs/x86_64-linux/ghc-$GHC_VERSION/bin:$PATH \
|
||||||
|
CUDA_PATH=/usr/local/cuda-$CUDA_VERSION \
|
||||||
|
CPATH=$JVM_PATH/include:$JVM_PATH/include/linux:/usr/lib/llvm-$LLVM_VERSION/include
|
||||||
|
|
||||||
|
#
|
||||||
|
# Install pre-requisites
|
||||||
|
#
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
wget netbase ca-certificates g++ gcc libc6-dev libffi-dev libgmp-dev \
|
||||||
|
make xz-utils zlib1g-dev git gnupg libtinfo-dev && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
#
|
||||||
|
# Use Stackage's debian-bootstrap.sh script to install system libraries and
|
||||||
|
# tools required to build any Stackage package.
|
||||||
|
# Re-installs 'stack' *after* running debian-bootstrap.sh since that may have
|
||||||
|
# installed a different version.
|
||||||
|
# In the case of 'small' image, just install Stack and GHC.
|
||||||
|
#
|
||||||
|
|
||||||
|
RUN if [ "$VARIANT" != "small" ]; then \
|
||||||
|
wget -qO- https://raw.githubusercontent.com/fpco/stackage/$BOOTSTRAP_COMMIT/debian-bootstrap.sh | sed "s/^GHCVER=8.6.5$/GHCVER=$GHC_VERSION/" | GHCVER=$GHC_VERSION bash; \
|
||||||
|
fi && \
|
||||||
|
wget -qO- https://github.com/commercialhaskell/stack/releases/download/v$STACK_VERSION/stack-$STACK_VERSION-linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C /usr/bin '*/stack' && \
|
||||||
|
if [ "$VARIANT" = "small" ]; then \
|
||||||
|
stack setup --resolver ghc-$GHC_VERSION; \
|
||||||
|
fi && \
|
||||||
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
|
cd $STACK_ROOT && \
|
||||||
|
find . -type f -not -path "./programs/x86_64-linux/ghc-$GHC_VERSION/*" -exec rm '{}' \; && \
|
||||||
|
find . -type d -print0 |sort -rz |xargs -0 rmdir 2>/dev/null || true
|
||||||
|
|
||||||
|
#
|
||||||
|
# Configure Stack to use the GHC installed in the Docker image rather than installing its own
|
||||||
|
#
|
||||||
|
|
||||||
|
RUN mkdir /etc/stack/ && \
|
||||||
|
echo "system-ghc: true" >/etc/stack/config.yaml
|
||||||
|
|
||||||
|
#
|
||||||
|
# Use 'stack' to install basic Haskell tools like alex, happy, and cpphs. We
|
||||||
|
# remove most of the STACK_ROOT afterward to save space, but keep the 'share'
|
||||||
|
# files that some of these tools require.
|
||||||
|
#
|
||||||
|
|
||||||
|
RUN stack --resolver=$LTS_SLUG --local-bin-path=/usr/bin install \
|
||||||
|
happy alex cpphs gtk2hs-buildtools hscolour hlint hindent && \
|
||||||
|
cd $STACK_ROOT && \
|
||||||
|
find . -type f -not -path './snapshots/*/share/*' -and -not -path "./programs/x86_64-linux/ghc-$GHC_VERSION/*" -exec rm '{}' \; && \
|
||||||
|
find . -type d -print0 |sort -rz |xargs -0 rmdir 2>/dev/null || true
|
||||||
|
|
||||||
|
#
|
||||||
|
# Install 'pid1' init daemon
|
||||||
|
#
|
||||||
|
|
||||||
|
RUN wget -O- "https://github.com/fpco/pid1/releases/download/v$PID1_VERSION/pid1-$PID1_VERSION-linux-x86_64.tar.gz" | tar xzf - -C /usr/local && \
|
||||||
|
chown root:root /usr/local/sbin && \
|
||||||
|
chown root:root /usr/local/sbin/pid1
|
||||||
|
|
||||||
|
#
|
||||||
|
# Set up pid1 entrypoint and default command
|
||||||
|
#
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/local/sbin/pid1"]
|
||||||
|
CMD ["bash"]
|
||||||
Loading…
Reference in New Issue
Block a user