-
Notifications
You must be signed in to change notification settings - Fork 25
/
Dockerfile
126 lines (115 loc) · 4.06 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
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
#for local env
FROM ubuntu:jammy
#for local MACOS env
#FROM --platform=linux/arm64/v8 ubuntu:jammy
# FROM public.ecr.aws/unocha/debian-base-s6:11-slim
ARG S6_VERSION=v2.2.0.3
ENV DEBIAN_FRONTEND=noninteractive \
LANG=en_US.UTF-8 \
LANGUAGE=en_US:en_US \
LC_ALL=en_US.UTF-8 \
HDX_CKAN_WORKERS=4 \
INI_FILE=/etc/ckan/prod.ini \
HDX_CACHE_DIR=/srv/cache \
HDX_LOG_LEVEL=INFO
WORKDIR /srv/ckan
COPY . .
# Install required system packages
RUN apt-get -qq -y update && \
# locales
apt-get -qq -y install locales && \
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
cp docker/locale /etc/default/locale && \
locale-gen en_US.UTF-8 && \
dpkg-reconfigure locales && \
update-locale LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8 && \
apt-get -q -y update && \
apt-get -q -y install \
build-essential \
curl \
gettext-base \
git-core \
gpg \
iputils-ping \
libmagic1 \
libpq-dev \
libxml2-dev \
libxslt-dev \
libgeos-dev \
libssl-dev \
libffi-dev \
nano \
net-tools \
postgresql-client \
procps \
psmisc \
python3 \
python3-pip \
vim \
wget && \
# make python3 and pip3 available as python and pip
ln -sf /usr/bin/python3 /usr/bin/python && \
ln -sf /usr/bin/pip3 /usr/bin/pip && \
# prepare nginx unit installation
curl --output /usr/share/keyrings/nginx-keyring.gpg https://unit.nginx.org/keys/nginx-keyring.gpg && \
echo "deb [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/ubuntu/ jammy unit" > /etc/apt/sources.list.d/unit.list && \
echo "deb-src [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/ubuntu/ jammy unit" >> /etc/apt/sources.list.d/unit.list && \
# install nginx unit
apt-get -qq -y update && \
apt-get -qq -y install \
unit unit-python3.10 && \
ln -sf /usr/lib/unit/modules/python3.8.unit.so /usr/lib/unit/modules/python.unit.so && \
# prepare files and folders
mkdir -p /var/log/ckan /srv/filestore /srv/webassets /etc/services.d/unit /etc/ckan && \
cd /srv/ckan && \
python -m pip install --upgrade pip && \
pip install -r requirement-setuptools.txt && \
#pip install --upgrade -r requirements.txt && \
pip install pip-tools==7.3.0 && \
pip-sync requirements.txt requirements-hdxckantool.txt && \
pip install \
elastic-apm[flask] \
newrelic && \
chmod +x run_pytest_with_coverage.sh && \
chmod +x setup_py_helper.sh && \
./setup_py_helper.sh && \
# #newrelic-admin generate-config LICENSE_KEY /srv/newrelic.ini && \
chown -R www-data ckan/public/base/i18n && \
cp -a docker/run_unit /etc/services.d/unit/run && \
chown www-data:www-data -R /var/log/ckan /srv/filestore && \
cp -a docker/hdxckantool-ng.py /srv/hdxckantool-ng.py && \
chmod +x /srv/hdxckantool-ng.py && \
ln -s /srv/hdxckantool-ng.py /usr/sbin/hdxckantool && \
echo "application/vnd.geo+json geojson" >> /etc/mime.types && \
apt-get -qq -y remove \
build-essential \
gpg \
libffi-dev \
libpq-dev \
libssl-dev \
libxml2-dev \
libxslt1-dev \
libyaml-dev \
zlib1g-dev && \
apt-get -y autoremove && \
apt-get clean && \
rm -rf \
/root/.cache \
/root/.npm \
/usr/local/man \
/usr/share/doc \
/usr/share/man \
/var/lib/apt/lists/* \
/var/tmp/* \
/tmp/* && \
S6_ARCH=$(uname -m | sed 's/x86_64/amd64/') && \
echo "Installing s6 version: $S6_VERSION for $S6_ARCH" && \
curl -o /tmp/s6-overlay.tar.gz -jkSL https://github.com/just-containers/s6-overlay/releases/download/${S6_VERSION}/s6-overlay-${S6_ARCH}.tar.gz && \
tar xzf /tmp/s6-overlay.tar.gz -C / && \
rm -f /tmp/s6-overlay.tar.gz && \
ln -sf /usr/bin/sh /bin/sh && \
ln -sf /usr/bin/bash /bin/bash
VOLUME ["/srv/filestore", "/srv/backup", "/var/log/ckan"]
EXPOSE 5000
ENTRYPOINT ["/init"]
CMD []