This repository has been archived by the owner on Jul 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 139
/
Dockerfile
79 lines (66 loc) · 1.89 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
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 python:3.11.3-slim
# Set up user and group.
ARG groupid=10001
ARG userid=10001
WORKDIR /app
RUN groupadd --gid $groupid app && \
useradd -g app --uid $userid --shell /usr/sbin/nologin --create-home app
# Set entrypoint for this image. The entrypoint script takes a service
# to run as the first argument. See the script for available arguments.
ENTRYPOINT ["/app/docker/app_entrypoint.sh"]
CMD ["shell"]
# Create an app user owned var/run section.
RUN mkdir -p /var/run/location/ && chown -R app:app /var/run/location/
# Disable installing doc/man/locale files.
RUN echo "\
path-exclude=/usr/share/doc/*\n\
path-exclude=/usr/share/man/*\n\
path-exclude=/usr/share/locale/*\n\
" > /etc/dpkg/dpkg.cfg.d/apt-no-docs
# Install apt-installable dependencies.
RUN apt-get update && \
apt-get -y install --no-install-recommends \
file \
g++ \
gcc \
gfortran \
libatlas-base-dev \
libffi-dev \
libgeos-dev \
liblapack-dev \
libmariadb-dev \
libmariadb-dev-compat \
libpng-dev \
libprotobuf-dev \
libspatialindex-dev \
libssl-dev \
make \
mariadb-client \
pkg-config \
pngquant \
protobuf-compiler \
redis-tools \
wget \
&& rm -rf /var/lib/apt/lists/*
# Install dependencies.
COPY ./docker.make /app/
COPY ./vendor /app/vendor/
RUN make -f docker.make build_deps
# Install Python libraries.
COPY requirements.txt /app/requirements.txt
RUN make -f docker.make build_python_deps
# Install geocalc.
COPY . /app
RUN make -f docker.make build_geocalc
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONPATH /app
# Run a couple checks to see if things got installed correctly.
RUN make -f docker.make build_check
# The app user only needs write access to very few places.
RUN chown app:app . && \
chown -R app:app /app/docs/ && \
chown -R app:app /app/ichnaea/
# Define the default web server port.
EXPOSE 8000
USER app