-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
69 lines (60 loc) · 1.92 KB
/
Dockerfile
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# SPDX-FileCopyrightText: 2021 - 2023 Robin Vobruba <[email protected]>
#
# SPDX-License-Identifier: Unlicense
FROM debian:latest
ARG HOME="/root"
RUN pwd
RUN apt-get update
RUN apt-get install \
--no-install-recommends \
-y \
-qq \
build-essential \
ca-certificates \
curl \
git \
libpcre2-dev \
libssl-dev \
mingw-w64 \
musl \
musl-dev \
musl-tools \
pandoc \
unzip \
zip
ARG WORK_DIR="$HOME"
WORKDIR "$WORK_DIR"
# Download and execute ChooseNim.
# It installs latest version of nim, nimble
# and some other basic Nim tools.
RUN curl "https://nim-lang.org/choosenim/init.sh" \
--output "choosenim_init.sh" \
-sSf
RUN sh choosenim_init.sh -y
ENV NIM_BINS="$HOME/.nimble/bin"
ENV PATH="$NIM_BINS:${PATH}"
# This can be set from outside,
# for example on the command line with:
# docker build . --build-arg NIM_VERSION=some_value # ... the rest of the build command is omitted
# NOTE This is replaced by the 'inject-dockerfile' script.
ARG NIM_VERSION="REPLACE_ME"
ARG GIT_VERSION="REPLACE_ME"
# Downloads and extracts the win64 version of nim.
# We need this for some DLL dependencies at runtime
# (strangely, not at compile-/link-time).
ARG NIM_WIN_VERSION=$NIM_VERSION
ARG NIM_WIN_DIR="nim-${NIM_WIN_VERSION}-win64"
ARG NIM_WIN_ARCH="nim-${NIM_WIN_VERSION}_x64.zip"
RUN curl "https://nim-lang.org/download/$NIM_WIN_ARCH" \
--output "$NIM_WIN_ARCH" \
-sSf
RUN unzip "$NIM_WIN_ARCH"
RUN mv "nim-${NIM_WIN_VERSION}" "$NIM_WIN_DIR"
# Make these available to the user of the docker image
ENV NIM_WIN_VERSION=$NIM_WIN_VERSION
ENV NIM_WIN_DIR="$WORK_DIR/$NIM_WIN_DIR"
RUN echo "Installed win64 Nim version: NIM_WIN_VERSION=$NIM_WIN_VERSION"
RUN echo "Installed win64 Nim dir: NIM_WIN_DIR='$NIM_WIN_DIR'"
LABEL maintainer="Robin Vobruba <[email protected]>"
LABEL version="$GIT_VERSION"
LABEL description="A CI base image when building nim(lang) packages for Linux (native compilation) and Windows (cross compilation)."