forked from mamba-org/micromamba-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (39 loc) · 1.64 KB
/
Dockerfile
File metadata and controls
47 lines (39 loc) · 1.64 KB
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
ARG BASE_IMAGE=debian:bullseye-slim
# Mutli-stage build to keep final image small. Otherwise end up with
# curl and openssl installed
FROM --platform=$BUILDPLATFORM $BASE_IMAGE AS stage1
ARG VERSION=0.17.0
RUN apt-get update && apt-get install -y \
bzip2 \
ca-certificates \
curl \
&& rm -rf /var/lib/{apt,dpkg,cache,log}
ARG TARGETARCH
RUN [ $TARGETARCH = 'amd64' ] && export ARCH='64'; \
[ $TARGETARCH = 'arm64' ] && export ARCH='aarch64'; \
[ $TARGETARCH = 'ppc64le' ] && export ARCH='ppc64le'; \
curl -L https://micromamba.snakepit.net/api/micromamba/linux-$ARCH/$VERSION | \
tar -xj -C /tmp bin/micromamba
FROM $BASE_IMAGE
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ENV ENV_NAME="base"
ENV MAMBA_ROOT_PREFIX="/opt/conda"
# Setting $BASH_ENV and the SHELL command will not result in .bashrc being sourced when
# you supply the program to run as an argument to the "docker run" command.
# Manually add directory for micromamba installed executables to PATH as a workaround.
ENV PATH "$MAMBA_ROOT_PREFIX/bin:$PATH"
# Use bash in Dockerfile RUN commands and make sure bashrc is sourced when
# executing commands with /bin/bash -c
# Needed to have the micromamba activate command configured etc.
SHELL ["/bin/bash", "-c"]
COPY --from=stage1 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=stage1 /tmp/bin/micromamba /bin/micromamba
COPY entrypoint.sh /bin/entrypoint.sh
RUN useradd -ms /bin/bash micromamba && \
mkdir -p "$MAMBA_ROOT_PREFIX" && \
chmod -R a+rwx "$MAMBA_ROOT_PREFIX" "/home" && \
export ENV_NAME="$ENV_NAME"
USER micromamba
WORKDIR /tmp
ENTRYPOINT ["/bin/entrypoint.sh"]
CMD ["/bin/bash"]