我正在尝试在gis
中使用docker
:
这是Django的Dockerfile
:
FROM python:3.6-alpine
ENV PYTHONUNBUFFERED 1
RUN apk update \
# psycopg2 dependencies
&& apk add --virtual build-deps gcc python3-dev musl-dev \
&& apk add postgresql-dev \
# Pillow dependencies
&& apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev \
# CFFI dependencies
&& apk add libffi-dev py-cffi \
# Translations dependencies
&& apk add gettext \
# https://docs.djangoproject.com/en/dev/ref/django-admin/#dbshell
&& apk add postgresql-client
# ADD PostGIS here
# POSTGIS dependencies
ENV POSTGIS_VERSION 2.4.4
ENV POSTGIS_SHA256 0dff4902556ad45430e2b85dbe7e9baa758c6eb0bfd5ff6948f478beddd56b67
RUN set -ex \
\
&& apk add --no-cache --virtual .fetch-deps \
ca-certificates \
openssl \
tar \
\
&& wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/$POSTGIS_VERSION.tar.gz" \
&& echo "$POSTGIS_SHA256 *postgis.tar.gz" | sha256sum -c - \
&& mkdir -p /usr/src/postgis \
&& tar \
--extract \
--file postgis.tar.gz \
--directory /usr/src/postgis \
--strip-components 1 \
&& rm postgis.tar.gz \
\
&& apk add --no-cache --virtual .build-deps \
autoconf \
automake \
g++ \
json-c-dev \
libtool \
libxml2-dev \
make \
perl \
\
# add libcrypto from (edge:main) for gdal-2.3.0
&& apk add --no-cache --virtual .crypto-rundeps \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
libressl2.7-libcrypto \
&& apk add --no-cache --virtual .build-deps-testing \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
gdal-dev \
geos-dev \
proj4-dev \
protobuf-c-dev \
&& cd /usr/src/postgis \
&& ./autogen.sh \
# configure options taken from:
# https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie
&& ./configure \
# --with-gui \
&& make \
&& make install \
&& apk add --no-cache --virtual .postgis-rundeps \
json-c \
&& apk add --no-cache --virtual .postgis-rundeps-testing \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
geos \
gdal \
py-gdal \
proj4 \
protobuf-c \
&& cd / \
&& rm -rf /usr/src/postgis \
&& apk del .fetch-deps .build-deps .build-deps-testing
# && apk del .fetch-deps .build-deps .build-deps-testing
# END POSTGIS Changes
# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements
RUN pip install -r /requirements/local.txt
COPY ./compose/production/django/entrypoint /entrypoint
RUN sed -i 's/\r//' /entrypoint
RUN chmod +x /entrypoint
COPY ./compose/local/django/start /start
RUN sed -i 's/\r//' /start
RUN chmod +x /start
COPY ./compose/local/django/celery/worker/start /start-celeryworker
RUN sed -i 's/\r//' /start-celeryworker
RUN chmod +x /start-celeryworker
COPY ./compose/local/django/celery/beat/start /start-celerybeat
RUN sed -i 's/\r//' /start-celerybeat
RUN chmod +x /start-celerybeat
COPY ./compose/local/django/celery/flower/start /start-flower
RUN sed -i 's/\r//' /start-flower
RUN chmod +x /start-flower
WORKDIR /app
ENTRYPOINT ["/entrypoint"]
这是我的Postgres Dockerfile
:
FROM mdillon/postgis
COPY ./compose/production/postgres/maintenance /usr/local/bin/maintenance
RUN chmod +x /usr/local/bin/maintenance/*
RUN mv /usr/local/bin/maintenance/* /usr/local/bin \
&& rmdir /usr/local/bin/maintenance
我在做什么错了?
答案 0 :(得分:1)
只需要删除Dockerfile
的这一行:&& apk del .fetch-deps .build-deps .build-deps-testing
我还没有弄清楚,但是很可能它会删除我在上面添加的所有软件包。
答案 1 :(得分:0)
我不确定,但是通过阅读debian软件包部分,您似乎并没有安装gdal-dev
或libgdal-dev
,名称取决于您的发布,但是您明白了。 / p>