Cross-platform nim-builder for arm32, arm64, amd64. NOT OFFICIAL, only used for personal projects.
85
These images are used for personal projects. Do not depend on them.
FROM nivviv/nim:1.6.4-alpine AS build
.. nimble nimble nimble ..
FROM alpine:latest
RUN apk --no-cache add dep...
COPY --from=build ... /app ..
ENTRYPOINT [ "/app...
#!/bin/bash
set -e
# When creating a new nim version image, update these:
NIM_VERSION="1.6.4"
NIM_SHA256="7fc3092855b5c2200cd9feed133d04605823f250d73b4d4ac501300370e0a0c2"
# Overall/target configuration.
DOCKER_IMAGE="nivviv/nim"
FLAVORS="alpine" # TODO: build focal
PLATFORMS="linux/arm64,linux/amd64"
PUSH=1 # 1=--push 0=--load
# I don't like default tags much. Better to be explicit which distro and verison you want.
# If you disagree, set it here (e.g. "alpine").
DEFAULT_FLAVOR=""
focal() {
cat << EOF
FROM ubuntu:focal
RUN apt-get update && \
apt-get install -y g++ curl git xz-utils && \
rm -rf /var/lib/apt/lists/*
EOF
}
alpine() {
cat << EOF
FROM alpine:latest
RUN apk add --no-cache g++ curl git tar xz
EOF
}
dockerNim() {
cat << EOF
ARG NIM_VERSION
ARG NIM_SHA256
RUN cd /opt && mkdir nim && \
echo "${NIM_SHA256} nim-${NIM_VERSION}.tar.xz" > nim-${NIM_VERSION}.tar.xz.sha256 && \
curl https://nim-lang.org/download/nim-${NIM_VERSION}.tar.xz -o nim-${NIM_VERSION}.tar.xz && \
sha256sum -c nim-${NIM_VERSION}.tar.xz.sha256 && \
tar -xv --strip-components 1 -C nim -f nim-${NIM_VERSION}.tar.xz && \
cd nim && \
sh build.sh && \
bin/nim c koch && ./koch boot -d:release && ./koch tools && \
rm -r nimcache c_code ../nim-${NIM_VERSION}.tar.xz
ENV PATH="/opt/nim/bin:\${PATH}"
EOF
}
echo "#!/bin/bash"
echo "set -e"
echo ""
echo "docker buildx create --name nim-crosscomp --bootstrap || true"
echo "docker buildx use nim-crosscomp"
for flavor in $FLAVORS; do
echo ""
${flavor} > Dockerfile.${flavor}
dockerNim >> Dockerfile.${flavor}
echo "# Wrote dockerfile: Dockerfile.${flavor}"
echo docker buildx build \\
echo " " --platform "$PLATFORMS" \\
echo " " --build-arg "NIM_VERSION=${NIM_VERSION}" \\
echo " " --build-arg "NIM_SHA256=${NIM_SHA256}" \\
echo " " -t "${DOCKER_IMAGE}:${NIM_VERSION}-${flavor}" \\
if [ "${flavor}" == "${DEFAULT_FLAVOR}" ]; then
echo " " -t "${DOCKER_IMAGE}:${NIM_VERSION}" \\
fi
echo " " -f Dockerfile.${flavor} \\
if [ $PUSH -eq 1 ]; then
echo " " --push \\
else
echo " " --load \\
fi
echo " " .
done
echo ""
echo "# You can run this script directly (./build.sh | bash), or you can run the "
echo "# commands manually. Dockerfiles have been generated in cwd."
echo "# See the comments in the source at the top before doing so."
Content type
Image
Digest
Size
101.5 MB
Last updated
over 4 years ago
docker pull nivviv/nim:1.6.4-alpine