-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
55 lines (40 loc) · 1.52 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
# base information
FROM python:3.11-slim
MAINTAINER Jan Fenker
# create user
RUN useradd --home-dir /home/app --create-home --shell /bin/bash --uid 1000 jef
# set workdir
WORKDIR /home/app
# upgrade system and install requirements (normal and build)
RUN apt-get update && \
mkdir -p /usr/share/man/man1 && \
mkdir -p /usr/share/man/man7 && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends fonts-dejavu gcc libc-dev git gpg libmagic1 libpq-dev postgresql-client xz-utils && \
pip install -U pip setuptools --no-cache-dir && \
rm -rf /root/.cache /var/cache/*
# install python requirements and do cleanup
COPY requirements.txt requirements.txt
RUN pip install -U -r requirements.txt --no-cache-dir && \
rm -rf /root/.cache /var/cache/*
#create state directory
RUN mkdir /state && \
chown -R jef:jef /state
# copy code & config
COPY --chown=jef:jef uwsgi.ini uwsgi.ini
COPY --chown=jef:jef src src
#COPY src/__init__.py /home/source/code/
# switch to jef user
USER 1000
# setup app
RUN python -m src.setup
#expose port
EXPOSE 3031
# set default startup command
CMD ["uwsgi --ini uwsgi.ini"]
# define entrypoint for example/test
#ENTRYPOINT FLASK_APP=__init__.py flask run --host=0.0.0.0
# setup directory for ssl keys and get keys stored in ssl folder
#RUN mkdir -p /home/source/ssl
#RUN openssl req -newkey rsa:2048 -nodes -keyout /home/source/ssl/domain.key -x509 -days 365 \
# -out /home/source/ssl/domain.crt -subj "/C=DE/ST=Baden-Wuerttemberg/L=Karlsruhe/O=jef/OU=KIT SPZ/CN=localhost"