forked from mapproxy/mapproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-alpine
131 lines (91 loc) · 2.93 KB
/
Dockerfile-alpine
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
FROM python:3.12-alpine AS base-libs
LABEL maintainer="mapproxy.org"
RUN apk -U upgrade --update \
&& apk add \
g++ \
py3-pip \
gdal \
gdal-dev \
gdal \
gdal-dev \
libxslt-dev \
libxml2 \
proj \
proj-dev \
proj-util \
geos \
geos-dev \
libffi-dev \
&& rm -rf /var/cache/apk/*
FROM base-libs AS builder
RUN mkdir /mapproxy
WORKDIR /mapproxy
COPY setup.py MANIFEST.in README.md CHANGES.txt AUTHORS.txt COPYING.txt LICENSE.txt ./
COPY mapproxy mapproxy
RUN rm -rf dist/*
RUN pip wheel . -w dist
FROM base-libs AS base
RUN mkdir /mapproxy
RUN addgroup -S mapproxy && \
adduser -D -s /bin/sh -S -h /mapproxy/ -G mapproxy mapproxy
USER mapproxy:mapproxy
WORKDIR /mapproxy
ENV PATH="${PATH}:/mapproxy/.local/bin"
RUN mkdir mapproxy-dist
COPY --from=builder /mapproxy/dist/* mapproxy-dist/
RUN pip install requests riak==2.4.2 redis boto3 azure-storage-blob Shapely && \
pip install --find-links=./mapproxy-dist --no-index MapProxy && \
pip cache purge
COPY docker/app.py .
COPY docker/entrypoint.sh .
ENTRYPOINT ["./entrypoint.sh"]
CMD ["echo", "no CMD given"]
###### development image ######
FROM base AS development
EXPOSE 8080
CMD ["mapproxy-util", "serve-develop", "-b", "0.0.0.0", "/mapproxy/config/mapproxy.yaml"]
##### nginx image ######
FROM base AS nginx
# use current version of nginx
ARG NGINX_VERSION=1.25.3
USER root:root
RUN apk --no-cache add ca-certificates uwsgi uwsgi-python3 supervisor pcre-dev && \
rm -rf /var/cache/apk/*
RUN apk --no-cache add build-base linux-headers openssl-dev wget zlib-dev && \
su mapproxy -c "pip install uwsgi" && \
cd /tmp && \
wget https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && \
tar xzf nginx-${NGINX_VERSION}.tar.gz && \
cd /tmp/nginx-${NGINX_VERSION} && \
./configure \
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/var/cache/nginx/client_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
--user=mapproxy \
--group=mapproxy && \
make && \
make install && \
rm -rf /tmp/* && \
apk del build-base linux-headers openssl-dev wget zlib-dev && \
rm -rf /var/cache/apk/*
USER mapproxy:mapproxy
COPY docker/uwsgi.conf .
COPY docker/nginx-alpine-default.conf /etc/nginx/nginx.conf
COPY docker/run-nginx.sh .
EXPOSE 80
USER root:root
RUN mkdir /var/cache/nginx \
&& chown -R mapproxy:mapproxy /var/cache/nginx \
&& chown -R mapproxy:mapproxy /var/log/nginx \
&& touch /var/run/nginx.pid \
&& chown -R mapproxy:mapproxy /var/run/nginx.pid \
&& chown -R mapproxy:mapproxy /etc/nginx
USER mapproxy:mapproxy
CMD ["./run-nginx.sh"]