-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (28 loc) · 842 Bytes
/
Dockerfile
File metadata and controls
28 lines (28 loc) · 842 Bytes
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
FROM python:3.10-slim
# set time zone to europe berlin
ENV TZ="Europe/Berlin"
# switch to root for install
USER root
# install glpk
RUN apt-get update && apt-get install --no-install-recommends -y gcc g++ libglpk-dev glpk-utils\
&& rm -rf /var/lib/apt/lists/*
# install requirements
COPY ./requirements.txt .
#RUN python -m pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# add user to start python script
RUN useradd -s /bin/bash admin
# make working directory
RUN mkdir /src
RUN chown -R admin /src
# fix pypsa error --> PermissionError: [Errno 13] Permission denied: '/home/admin'
RUN mkdir -p /home/admin
RUN chown -R admin /home/admin
# copy script file to working directory
COPY . /src
# switch to user admin
USER admin
# set working directory
WORKDIR /src
# run script
CMD ["python", "-u" ,"./main.py"]