-
Notifications
You must be signed in to change notification settings - Fork 1
/
rootless.Dockerfile
91 lines (77 loc) · 2.35 KB
/
rootless.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
FROM ubuntu:noble-20240801 AS nim
ARG version_nim=2.0.8
RUN \
apt-get update && \
apt-get install -y \
curl \
xz-utils \
gcc \
openssl \
ca-certificates \
git && \
rm -fr /tmp/* && \
rm -fr /var/lib/apt/lists/*
WORKDIR /src
RUN \
curl -fsSLO https://nim-lang.org/download/nim-${version_nim}.tar.xz && \
tar -xJf nim-${version_nim}.tar.xz && \
cd nim-${version_nim} && \
sh build.sh && \
bin/nim c koch && \
chmod +x koch && \
./koch boot -d:release && \
./koch tools && \
bash install.sh /usr/bin
FROM ubuntu:noble-20240801
# Nim Semver
ARG version_nim=2.0.8
# User ID & Group ID for Rootless Image User
ARG PUID=1000
ARG PGID=1000
# Image Metadata
ARG BUILD_VERSION
ARG BUILD_REVISION
ARG BUILD_DATE
# Make Binaries installed through Nimble available
ENV PATH=/home/nim/.nimble/bin:$PATH
LABEL maintainer="Akito <[email protected]>"
LABEL org.opencontainers.image.authors="Akito <[email protected]>"
LABEL org.opencontainers.image.vendor="Akito"
LABEL org.opencontainers.image.version="${BUILD_VERSION}"
LABEL org.opencontainers.image.revision="${BUILD_REVISION}"
LABEL org.opencontainers.image.created="${BUILD_DATE}"
LABEL org.opencontainers.image.title="Multi-arch Nim Compiler - Rootless"
LABEL org.opencontainers.image.description="Nim Compiler for different CPU architectures. Rootless edition."
LABEL org.opencontainers.image.url="https://hub.docker.com/r/akito13/nim"
LABEL org.opencontainers.image.documentation="https://github.com/theAkito/docker-nim?tab=readme-ov-file#run"
LABEL org.opencontainers.image.source="https://github.com/theAkito/docker-nim"
LABEL org.opencontainers.image.licenses="GPL-3.0+"
# Copy from Source directory, rather than from /usr/bin.
# https://github.com/nim-lang/Nim/issues/18979
COPY --from=nim /src/nim-${version_nim}/bin /usr/bin
COPY --from=nim /usr/lib/nim /usr/lib/nim
COPY --from=nim /etc/nim /etc/nim
RUN \
apt-get update && \
# Nimble Dependencies
apt-get install -y \
curl \
git \
gcc \
openssl \
ca-certificates && \
# Clean up
rm -fr /tmp/* && \
rm -fr /var/lib/apt/lists/* && \
# Fix Nim Installation
ln -s /usr/lib/nim /usr/lib/nim/lib && \
# Create Group & User for Rootless Image Usage
addgroup --gid ${PGID} nim && \
adduser -q \
--disabled-password \
--uid ${PUID} \
--gid ${PGID} \
--gecos "" \
--home /home/nim \
nim
USER nim