Reputation: 699
The following is the Dockerfile,
FROM alpine:3.10
# Add the testing repo in case it's needed for additional dependencies
# For example, gdal can be installed by using gdal@community
RUN echo "@community http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
# Install system dependencies
RUN apk add --no-cache --update \
bash \
gcc \
build-base \
musl-dev \
postgresql-dev \
'python3~=3.7.5' \
'python3-dev~=3.7.5' \
curl \
# zlib, zlib-dev, and libjpeg-turbo are required by pillow
zlib \
zlib-dev \
libjpeg-turbo \
libjpeg-turbo-dev \
libffi-dev
RUN pip3 install --no-cache-dir -q pipenv
# Add our code
ADD ./ /opt/webapp/
WORKDIR /opt/webapp
# Install dependencies
RUN pipenv install --deploy --system
# Allow SECRET_KEY to be passed via arg so collectstatic can run during build time
ARG SECRET_KEY
RUN python3 manage.py collectstatic --no-input
# Run the image as a non-root user
RUN adduser -D myuser
USER myuser
# Run the web server on port $PORT
CMD waitress-serve --port=$PORT performit_15391.wsgi:application
The following is the LOG from the server that is recorded, I don't know why the build is failing, can anybody guide please?
=== Fetching app code.
=== Building release (./backend/Dockerfile)
Sending build context to Docker daemon 895kB
Step 1/12 : FROM alpine:3.10
3.10: Pulling from library/alpine
21c83c524219: Pulling fs layer
21c83c524219: Verifying Checksum
21c83c524219: Download complete
21c83c524219: Pull complete
Digest: sha256:f0e9534a598e501320957059cb2a23774b4d4072e37c7b2cf7e95b241f019e35
Status: Downloaded newer image for alpine:3.10
---> be4e4bea2c2e
Step 2/12 : RUN echo "@community http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
---> Running in 42057b30f8bf
Removing intermediate container 42057b30f8bf
---> 015ada914599
Step 3/12 : RUN apk add --no-cache --update bash gcc build-base musl-dev postgresql-dev 'python3~=3.7.5' 'python3-dev~=3.7.5' curl zlib zlib-dev libjpeg-turbo libjpeg-turbo-dev libffi-dev
---> Running in acf5e541c616
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
[91mERROR: unsatisfiable constraints:
[0m python3-3.7.7-r0:
breaks: world[python3~3.7.5]
satisfies: python3-dev-3.7.7-r0[python3=3.7.7-r0]
python3-dev-3.7.7-r0:
breaks: world[python3-dev~3.7.5]
The command '/bin/sh -c apk add --no-cache --update bash gcc build-base musl-dev postgresql-dev 'python3~=3.7.5' 'python3-dev~=3.7.5' curl zlib zlib-dev libjpeg-turbo libjpeg-turbo-dev libffi-dev' returned a non-zero code: 2
This above is the log, the apk command is failing. Is there any dependency issue? for me the log message isn't very much useful. Thanks in advance.
Upvotes: 0
Views: 24115
Reputation: 3059
There is a version conflict while installing Python. APK package manager supports python-3.7.7-r0
for alpine:3.10
. But you have explicitly mentioned version 3.7.5
which is not available. Here either you can go with python 3.7.7 or use a base image which has python 3.7.5 to build your app.
Upvotes: 3