-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-production
79 lines (62 loc) · 1.95 KB
/
Dockerfile-production
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
71
72
73
74
75
76
77
78
79
### from https://github.com/OSGeo/gdal/tree/master/docker ###
# Use latest gdal official image
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.9.1
# Load arguments
ARG VERSION_APP
ARG TAG_APP
# Set variables
ENV VERSION=${VERSION_APP}
ENV TAG=${TAG_APP}
# Update base container install
RUN apt-get clean
# Configure timezone
ENV TZ="Europe/Prague"
RUN echo $TZ > /etc/timezone
RUN apt-get update
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata
# Install dependencies
RUN apt-get -qq -y install cron && apt-get -y -qq install sudo
RUN apt-get install -y python3-pip libgdal-dev locales gettext poppler-utils unrar jq postgresql-client curl redis-tools
# Ensure locales configured correctly
RUN locale-gen cs_CZ.utf8
ENV LC_ALL='cs_CZ.utf8'
# Set python aliases for python3
RUN echo 'alias python=python3' >> ~/.bashrc
RUN echo 'alias pip=pip3' >> ~/.bashrc
# Set paths
ENV PATH="/scripts:${PATH}"
# Install Python dependencies
COPY ./webclient/requirements.txt .
RUN pip3 install -r requirements.txt --break-system-packages
# Set up application files
RUN mkdir /code
COPY ./webclient /code
WORKDIR /code
COPY ./scripts /scripts
RUN chmod +x /scripts/*
# Uploaded images
RUN mkdir -p /vol/web/media
# Static files for the app
RUN mkdir -p /vol/web/static
# Locales for translations
RUN mkdir -p /vol/web/locale/cs/LC_MESSAGES
RUN mkdir -p /vol/web/locale/en/LC_MESSAGES
# Create non-root user and set permissions
RUN userdel ubuntu
RUN adduser user
RUN passwd -d user
RUN usermod -aG sudo user
RUN chown -R user:user /vol
RUN chmod -R 755 /vol/web
RUN chown -R user:user /code
RUN chmod -R 755 /code
# Apply cron
RUN crontab -u user /scripts/crontab.txt
# Update version info
RUN echo "DATE:$(date +%Y%m%dT%H%M%S),VERSION:${VERSION}" > /version.txt
RUN sed -i "s/1.0.0/${VERSION}/g" ./templates/base_logged_in.html
RUN current_year=$(date +%Y) && \
sed -i "s/YYYY/${current_year}/g" ./templates/base_logged_in.html
# Set entrypoint and user
USER user
CMD ["entrypoint.sh"]