-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
36 lines (27 loc) · 1.15 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
FROM python:3.10-alpine
ARG ARG_APP_HOME=/home/app
ARG ARG_RUN_USER=app
ARG ARG_FLASK_APP=self_description_creator.py
ARG ARG_FLASK_RUN_PORT=8080
ENV FLASK_APP=${ARG_FLASK_APP}\
FLASK_RUN_HOST=0.0.0.0\
FLASK_RUN_PORT=${ARG_FLASK_RUN_PORT}\
APP_HOME=${ARG_APP_HOME}
LABEL description="A tool that creates Gaia-X Self Descriptions and is able to automatically send them to a GXFS Federated Catalogue instance."
# Ensure application will be run as non-root user for safety reasons
RUN echo "Adding run user to system" \
&& addgroup -S ${ARG_RUN_USER} -g 1000 \
&& adduser -S ${ARG_RUN_USER} -u 1000 -G ${ARG_RUN_USER}
# Copy required resources and set appropriate permissions
COPY src ${ARG_APP_HOME}
COPY requirements.txt ${ARG_APP_HOME}/
COPY openapi-spec.yaml ${ARG_APP_HOME}/
RUN chown -R ${ARG_RUN_USER}:${ARG_RUN_USER} ${ARG_APP_HOME}
WORKDIR ${ARG_APP_HOME}
# Install dependencies for web app
RUN pip install --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# Use user id instead of user name to allow Kubernetes to check for non-root user
USER 1000
EXPOSE ${ARG_FLASK_RUN_PORT}
CMD ["python", "self_description_creator.py"]