Skip to content

Commit

Permalink
Switch user to run
Browse files Browse the repository at this point in the history
  • Loading branch information
oguzhankoral committed Oct 24, 2023
1 parent 107cfca commit a2c1fbe
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ ENV DEBIAN_FRONTEND=noninteractive
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
Expand All @@ -15,11 +18,19 @@ 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 requirements.txt && pip3 install -r requirements.txt
RUN poetry export -f requirements.txt --output /home/openfoamRunner/requirements.txt && pip3 install -r /home/openfoamRunner/requirements.txt

CMD ["/bin/bash"]

### POST-COMPILE (WIP) ###

Expand Down

0 comments on commit a2c1fbe

Please sign in to comment.