-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.rust
123 lines (103 loc) · 3.73 KB
/
Dockerfile.rust
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
FROM ghcr.io/linuxserver/baseimage-debian:bookworm AS build
ARG TARGETARCH
ENV PATH="/work/opt/bin:$PATH"
ENV HOST_ENVIRONMENT=container
RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked,mode=0755 \
--mount=target=/var/cache/apt,type=cache,sharing=locked,mode=0755 \
set -eux; \
apt update; \
apt upgrade -y; \
apt install -y --no-install-recommends \
ca-certificates \
libicu72 \
tzdata \
xz-utils \
vim \
git \
git-lfs \
build-essential \
iputils-ping \
iproute2 \
procps \
binutils \
ncdu \
unzip \
curl \
file \
; \
useradd -s /bin/bash -m sprout; \
echo "alias l='ls -laFHh'" >> /root/.bashrc; \
mkdir -p /work/app /work/opt/bin; \
rm -rf /var/lib/apt/lists/*;
# install watchexec
RUN set -eux; \
if [ "$TARGETARCH" = "arm64" ]; then \
ARCH="aarch64"; \
else \
ARCH="x86_64"; \
fi; \
curl -o /tmp/watchexec.tar.xz -LsSf https://github.com/watchexec/watchexec/releases/download/v2.1.2/watchexec-2.1.2-${ARCH}-unknown-linux-gnu.tar.xz; \
tar -C /work/opt/bin --strip-components=1 -xf /tmp/watchexec.tar.xz watchexec-2.1.2-${ARCH}-unknown-linux-gnu/watchexec
# install dockerize
RUN set -eux; \
curl -o /tmp/dockerize.tgz -LsSf https://github.com/jwilder/dockerize/releases/download/v0.7.0/dockerize-linux-${TARGETARCH}-v0.7.0.tar.gz; \
tar -C /work/opt/bin -xf /tmp/dockerize.tgz
# add static curl
RUN set -eux; \
if [ "$TARGETARCH" = "arm64" ]; then \
ARCH="aarch64"; \
else\
ARCH="x86_64"; \
fi; \
curl -o /tmp/curl.tgz -L -C - https://github.com/stunnel/static-curl/releases/download/8.11.1/curl-linux-${ARCH}-glibc-8.11.1.tar.xz; \
tar -C /work/opt/bin -xf /tmp/curl.tgz
# install python via miniconda
ENV PATH=/work/opt/venv/bin:$PATH
ENV UV_PYTHON_INSTALL_DIR=/work/opt/python
ENV RUSTUP_HOME=/work/opt/rustup
ENV CARGO_HOME=/work/opt/cargo
# install fnm/node
RUN --mount=target=/root/.cache/pip,type=cache,sharing=locked,mode=0755 \
set -eux; \
if [ "$TARGETARCH" = "arm64" ]; then \
ARCH="aarch64"; \
else \
ARCH="x86_64"; \
fi; \
curl -o /tmp/rustup.sh -sSf https://sh.rustup.rs; \
sh /tmp/rustup.sh -y; \
rm -fr /work/opt/rustup/toolchains/stable-${ARCH}-unknown-linux-gnu/share/doc;
FROM build AS final
# don't bother being gracful in dev images.
# can be overriden in final image if req.
ENV S6_KILL_GRACETIME=0
ENV S6_KEEP_ENV=1
# linux defaults. override in compose.
ENV PUID=1000
ENV PGID=1000
COPY <<EOF /etc/s6-overlay/s6-rc.d/init-adduser/branding
::::::::: :::::::: :::::::: ::: ::: :::::::::: :::::::::
:+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+:
+:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+
+#+ +:+ +#+ +:+ +#+ +#++:++ +#++:++# +#++:++#:
+#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+
#+# #+# #+# #+# #+# #+# #+# #+# #+# #+# #+#
######### ######## ######## ### ### ########## ### ###
EOF
ENV RUSTUP_HOME=/work/opt/rustup
ENV CARGO_HOME=/work/opt/cargo
LABEL org.opencontainers.image.rust_version="1.84.0"
COPY <<EOF /etc/s6-overlay/s6-rc.d/init-adduser/branding
::::::::: ::: ::: :::::::: :::::::::::
:+: :+: :+: :+: :+: :+: :+:
+:+ +:+ +:+ +:+ +:+ +:+
+#++:++#: +#+ +:+ +#++:++#++ +#+
+#+ +#+ +#+ +#+ +#+ +#+
#+# #+# #+# #+# #+# #+# #+#
### ### ######## ######## ###
EOF
RUN set -eux; \
rm -rf /var/lib/apt/lists/*
WORKDIR /work/app
LABEL org.opencontainers.image.watchexec_version="2.1.2"
LABEL org.opencontainers.image.dockerize_version="0.7.0"