2021-05-10 15:21:02 +02:00
|
|
|
FROM alpine:3.13
|
2020-09-17 11:42:27 +02:00
|
|
|
|
|
|
|
ENV APP_DIR=/srv/app
|
2021-05-10 15:21:02 +02:00
|
|
|
ENV GIT_BRANCH 0.0.17
|
2020-09-17 11:42:27 +02:00
|
|
|
ENV GIT_URL https://github.com/ckan/datapusher.git
|
|
|
|
ENV JOB_CONFIG ${APP_DIR}/datapusher_settings.py
|
|
|
|
|
|
|
|
WORKDIR ${APP_DIR}
|
|
|
|
|
2021-05-10 15:21:02 +02:00
|
|
|
RUN apk add --no-cache \
|
|
|
|
python3 \
|
|
|
|
py3-pip \
|
|
|
|
py3-wheel \
|
2020-09-17 11:42:27 +02:00
|
|
|
libffi-dev \
|
|
|
|
libressl-dev \
|
2021-05-10 15:21:02 +02:00
|
|
|
libxslt \
|
|
|
|
uwsgi \
|
|
|
|
uwsgi-http \
|
|
|
|
uwsgi-corerouter \
|
|
|
|
uwsgi-python \
|
|
|
|
# Temporary packages to build DataPusher requirements
|
|
|
|
&& apk add --no-cache --virtual .build-deps \
|
2020-09-17 11:42:27 +02:00
|
|
|
gcc \
|
|
|
|
git \
|
|
|
|
musl-dev \
|
2021-05-10 15:21:02 +02:00
|
|
|
python3-dev \
|
2020-09-17 11:42:27 +02:00
|
|
|
libxml2-dev \
|
2021-05-10 15:21:02 +02:00
|
|
|
libxslt-dev \
|
|
|
|
libmagic \
|
|
|
|
openssl-dev \
|
|
|
|
cargo
|
|
|
|
|
|
|
|
RUN mkdir ${APP_DIR}/src && cd ${APP_DIR}/src && \
|
2020-09-17 11:42:27 +02:00
|
|
|
git clone -b ${GIT_BRANCH} --depth=1 --single-branch ${GIT_URL} && \
|
|
|
|
cd datapusher && \
|
2021-05-10 15:21:02 +02:00
|
|
|
python3 setup.py install && \
|
|
|
|
pip3 install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
|
|
RUN apk del .build-deps && \
|
|
|
|
cp ${APP_DIR}/src/datapusher/deployment/*.* ${APP_DIR} && \
|
|
|
|
# Remove default values in ini file
|
|
|
|
sed -i '/http/d' ${APP_DIR}/datapusher-uwsgi.ini && \
|
|
|
|
sed -i '/wsgi-file/d' ${APP_DIR}/datapusher-uwsgi.ini && \
|
|
|
|
sed -i '/virtualenv/d' ${APP_DIR}/datapusher-uwsgi.ini && \
|
2020-09-17 11:42:27 +02:00
|
|
|
rm -rf ${APP_DIR}/src
|
|
|
|
|
2021-05-10 15:21:02 +02:00
|
|
|
# Create a local user and group to run the app
|
|
|
|
RUN addgroup -g 92 -S www-data && \
|
|
|
|
adduser -u 92 -h /srv/app -H -D -S -G www-data www-data
|
2020-09-17 11:42:27 +02:00
|
|
|
|
|
|
|
EXPOSE 8800
|
2021-05-10 15:21:02 +02:00
|
|
|
CMD ["sh", "-c", \
|
|
|
|
"uwsgi --plugins=http,python --http=0.0.0.0:8800 --socket=/tmp/uwsgi.sock --ini=`echo ${APP_DIR}`/datapusher-uwsgi.ini --wsgi-file=`echo ${APP_DIR}`/datapusher.wsgi"]
|