-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dymola.Dockerfile
81 lines (57 loc) · 2.79 KB
/
Dymola.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
ARG PYTHON_VERSION=3.9
# bring in the micromamba image so we can copy files from it
FROM mambaorg/micromamba:2.0.2 as micromamba
# This is the image we are going add micromaba to:
FROM registry.git.rwth-aachen.de/ebc/ebc_intern/dymola-docker:Dymola_2022
# Redeclare the ARG after FROM
ARG PYTHON_VERSION
USER root
# Install CA certificates
RUN apt-get update && apt-get install -y ca-certificates && update-ca-certificates
# if your image defaults to a non-root user, then you may want to make the
# next 3 ARG commands match the values in your image. You can get the values
# by running: docker run --rm -it my/image id -a
ARG MAMBA_USER=mambauser
ARG MAMBA_USER_ID=57439
ARG MAMBA_USER_GID=57439
ENV MAMBA_USER=$MAMBA_USER
ENV MAMBA_ROOT_PREFIX="/opt/conda"
ENV MAMBA_EXE="/bin/micromamba"
# Add the DYMOLA_RUNTIME_LICENSE environment variable
ENV DYMOLA_RUNTIME_LICENSE="ANY [email protected]"
COPY --from=micromamba "$MAMBA_EXE" "$MAMBA_EXE"
COPY --from=micromamba /usr/local/bin/_activate_current_env.sh /usr/local/bin/_activate_current_env.sh
COPY --from=micromamba /usr/local/bin/_dockerfile_shell.sh /usr/local/bin/_dockerfile_shell.sh
COPY --from=micromamba /usr/local/bin/_entrypoint.sh /usr/local/bin/_entrypoint.sh
COPY --from=micromamba /usr/local/bin/_dockerfile_initialize_user_accounts.sh /usr/local/bin/_dockerfile_initialize_user_accounts.sh
COPY --from=micromamba /usr/local/bin/_dockerfile_setup_root_prefix.sh /usr/local/bin/_dockerfile_setup_root_prefix.sh
RUN /usr/local/bin/_dockerfile_initialize_user_accounts.sh && \
/usr/local/bin/_dockerfile_setup_root_prefix.sh
USER $MAMBA_USER
SHELL ["/usr/local/bin/_dockerfile_shell.sh"]
ENTRYPOINT ["/usr/local/bin/_entrypoint.sh"]
# Optional: if you want to customize the ENTRYPOINT and have a conda
# environment activated, then do this:
# ENTRYPOINT ["/usr/local/bin/_entrypoint.sh", "my_entrypoint_program"]
# You can modify the CMD statement as needed....
CMD ["/bin/bash"]
# Set the Python version as an environment variable
ENV PYTHON_VERSION=${PYTHON_VERSION}
# Copy the environment file
COPY --chown=$MAMBA_USER:$MAMBA_USER env.yaml /tmp/env.yaml
# Modify the env.yaml file to include the specified Python version
RUN micromamba install -y -n base -c conda-forge -f /tmp/env.yaml python=${PYTHON_VERSION} --retry-clean-cache && \
micromamba clean --all --yes
USER $MAMBA_USER
WORKDIR /home/$MAMBA_USER
SHELL ["/usr/local/bin/_dockerfile_shell.sh"]
ENTRYPOINT ["/usr/local/bin/_entrypoint.sh"]
CMD ["/bin/bash"]
ARG MAMBA_DOCKERFILE_ACTIVATE=1
ENV PIP_DEFAULT_TIMEOUT=500
# Copy files to the user's home directory
COPY --chown=$MAMBA_USER:$MAMBA_USER . .
# Install the package
RUN pip install --no-cache-dir --user -e . -i https://pypi.tuna.tsinghua.edu.cn/simple
# Add .local/bin to PATH
ENV PATH=/home/$MAMBA_USER/.local/bin:$PATH