-
Notifications
You must be signed in to change notification settings - Fork 40
/
Dockerfile
125 lines (92 loc) · 5 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
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
124
# ---------------------------------------------------------------------------- #
# BASE IMAGE #
# ---------------------------------------------------------------------------- #
ARG UBUNTU_VERSION=24.04
FROM ubuntu:${UBUNTU_VERSION}
# ---------------------------------------------------------------------------- #
# CONTAINER ARGUMENTS AND ENV CONFIG #
# ---------------------------------------------------------------------------- #
# -------------------------------- ENERGYPLUS -------------------------------- #
# VERSION ARGUMENTS
ARG ENERGYPLUS_VERSION=24.1.0
ARG ENERGYPLUS_INSTALL_VERSION=24-1-0
ARG ENERGYPLUS_SHA=9d7789a3ac
#ENV CONFIGURATION
ENV ENERGYPLUS_TAG=v$ENERGYPLUS_VERSION
ENV EPLUS_PATH=/usr/local/EnergyPlus-$ENERGYPLUS_INSTALL_VERSION
# Downloading from Github
# e.g. https://github.com/NREL/EnergyPlus/releases/download/v23.1.0/EnergyPlus-23.1.0-87ed9199d4-Linux-Ubuntu22.04-x86_64.sh
ENV ENERGYPLUS_DOWNLOAD_BASE_URL https://github.com/NREL/EnergyPlus/releases/download/$ENERGYPLUS_TAG
ENV ENERGYPLUS_DOWNLOAD_FILENAME EnergyPlus-$ENERGYPLUS_VERSION-$ENERGYPLUS_SHA-Linux-Ubuntu22.04-x86_64.sh
ENV ENERGYPLUS_DOWNLOAD_URL $ENERGYPLUS_DOWNLOAD_BASE_URL/$ENERGYPLUS_DOWNLOAD_FILENAME
# Python add pyenergyplus path in order to detect API package
ENV PYTHONPATH="/usr/local/EnergyPlus-${ENERGYPLUS_INSTALL_VERSION}"
# ---------------------------------- PYTHON ---------------------------------- #
# VERSION ARGUMENT
ARG PYTHON_VERSION=3.12
# ENV CONFIGURATION
ENV PIP_BREAK_SYSTEM_PACKAGES=1
# ---------------------------------- POETRY ---------------------------------- #
# ENV CONFIGURATION
ENV POETRY_NO_INTERACTION=1
ENV POETRY_VIRTUALENVS_IN_PROJECT=0
ENV POETRY_VIRTUALENVS_CREATE=0
ENV POETRY_CACHE_DIR=/tmp/poetry_cache
# ------------------------- SINERGYM EXTRA LIBRERIES ------------------------- #
ARG SINERGYM_EXTRAS=""
# ------------------------- WANDB API KEY (IF EXISTS) ------------------------ #
ARG WANDB_API_KEY
ENV WANDB_API_KEY=${WANDB_API_KEY}
# LC_ALL for python locale error (https://bobbyhadz.com/blog/locale-error-unsupported-locale-setting-in-python)
ENV LC_ALL=C
# ---------------------------------------------------------------------------- #
# INSTALLATION AND CONFIGURATION #
# ---------------------------------------------------------------------------- #
# --------------------- APT UPDATE AND MANDATORY PACKAGES -------------------- #
RUN apt update && apt upgrade -y
RUN apt install -y ca-certificates build-essential curl libx11-6 libexpat1 git wget python3
# -------------------------- ENERGYPLUS INSTALLATION ------------------------- #
RUN curl -SLO $ENERGYPLUS_DOWNLOAD_URL \
&& chmod +x $ENERGYPLUS_DOWNLOAD_FILENAME \
&& echo "y\r" | ./$ENERGYPLUS_DOWNLOAD_FILENAME \
&& rm $ENERGYPLUS_DOWNLOAD_FILENAME \
&& cd /usr/local/EnergyPlus-$ENERGYPLUS_INSTALL_VERSION \
&& rm -rf PostProcess/EP-Compare PreProcess/FMUParser PreProcess/ParametricPreProcessor PreProcess/IDFVersionUpdater \
# Remove the broken symlinks
&& cd /usr/local/bin find -L . -type l -delete
# ------------------------ PYTHON AND PIP CONFIGURTION ----------------------- #
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
&& python3 get-pip.py \
&& rm get-pip.py \
&& pip install --upgrade pip setuptools wheel \
&& ln -s /usr/bin/python3 /usr/bin/python \
# Install some apt dependencies
&& echo "Y\r" | apt install python3-enchant -y \
&& echo "Y\r" | apt install pandoc -y
# ---------------------------- POETRY CONFIGURTION --------------------------- #
# Install Poetry
RUN curl -sSL https://install.python-poetry.org | python3 -
# Add Poetry to PATH
ENV PATH="/root/.local/bin:$PATH"
# -------------------------------- CLEAN FILES ------------------------------- #
RUN apt autoremove -y && apt autoclean -y \
&& rm -rf /var/lib/apt/lists/*
# ---------------------------------------------------------------------------- #
# WORKDIR AND COPY FILES #
# ---------------------------------------------------------------------------- #
WORKDIR /workspaces/sinergym
COPY README.md /workspaces/sinergym/README.md
COPY LICENSE /workspaces/sinergym/LICENSE
COPY INSTALL.md /workspaces/sinergym/INSTALL.md
COPY CODE_OF_CONDUCT.md /workspaces/sinergym/CODE_OF_CONDUCT.md
COPY scripts /workspaces/sinergym/scripts
COPY tests /workspaces/sinergym/tests
COPY sinergym /workspaces/sinergym/sinergym
COPY pyproject.toml /workspaces/sinergym/pyproject.toml
COPY poetry.lock /workspaces/sinergym/poetry.lock
# ---------------------------------------------------------------------------- #
# SINERGYM PACKAGE INSTALLATION (POETRY) #
# ---------------------------------------------------------------------------- #
RUN poetry install --no-interaction --only main --extras "$SINERGYM_EXTRAS"
# Execute the command
CMD ["python", "scripts/try_env.py"]