generated from specklesystems/speckle_automate_python_example
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
70 lines (50 loc) · 2.2 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
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
# setup timezone
ENV TZ=Europe/Istanbul
ENV VM_PROJECT_DIR=/opt/openfoam9
# Create a non-root user
RUN useradd -ms /bin/bash openfoamRunner
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt update
RUN apt install -y wget software-properties-common python3-pip
RUN wget -O - https://dl.openfoam.org/gpg.key > /etc/apt/trusted.gpg.d/openfoam.asc
RUN add-apt-repository http://dl.openfoam.org/ubuntu
RUN apt-get update
RUN apt-get -y --no-install-recommends install openfoam9
RUN echo "source /opt/openfoam9/etc/bashrc" >> /root/.bashrc
RUN echo "source /opt/openfoam9/etc/bashrc" >> /home/openfoamRunner/.bashrc
RUN pip install poetry
# Change the ownership of your project directory to the non-root user
RUN chown -R openfoamRunner:openfoamRunner $VM_PROJECT_DIR
USER openfoamRunner
COPY . .
RUN poetry export -f requirements.txt --output /home/openfoamRunner/requirements.txt && pip3 install -r /home/openfoamRunner/requirements.txt
CMD ["/bin/bash"]
### POST-COMPILE (WIP) ###
# FROM ubuntu:22.04
# ENV DEBIAN_FRONTEND=noninteractive
# # setup timezone
# ENV TZ=Europe/Istanbul
# RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# RUN apt update
# RUN apt install -y wget software-properties-common python3-pip build-essential cmake flex openmpi-bin libopenmpi-dev
# RUN wget -O - https://dl.openfoam.org/gpg.key > /etc/apt/trusted.gpg.d/openfoam.asc
# RUN add-apt-repository http://dl.openfoam.org/ubuntu
# RUN apt-get update
# # Download and compile OpenFOAM 9 manually
# WORKDIR /opt
# RUN wget -O OpenFOAM-9.tar.gz http://dl.openfoam.org/source/9
# RUN mkdir OpenFOAM-9
# RUN tar -xzf OpenFOAM-9.tar.gz -C /opt/OpenFOAM-9 --strip-components=1
# WORKDIR /opt/OpenFOAM-9
# # Cleanup unnecessary files to reduce the image size
# RUN rm -rf /opt/OpenFOAM-9.tar.gz
# # Set up environment variables
# RUN echo "source /opt/OpenFOAM-9/etc/bashrc" >> /root/.bashrc
# # Build OpenFOAM
# RUN /bin/bash -c "source /opt/OpenFOAM-9/etc/bashrc && /opt/OpenFOAM-9/Allwmake"
# RUN pip install poetry
# WORKDIR /
# COPY . .
# RUN poetry export -f requirements.txt --output requirements.txt && pip3 install -r requirements.txt