Hi I prepared an app and want to deploy it.
As I learned Docker should be an easy tool to accomplish this but I spent so much time to create a Docker image. Tried many thing but still having
"Service 'app' failed to build : The command '/bin/sh -c pip install -r /requirements.txt' returned a non-zero code: 1" error.
#UPDATE
Found out that cryptograph package causing the issue. Made some search and solved that but another one came up.
Final issues are:
ERROR: Failed building wheel for pyzmq
ERROR: Failed building wheel for pandas
ERROR: Could not build wheels for pandas which use PEP 517 and cannot be installed directly
requirements.txt file:
aioredis==1.3.1
asgiref==3.2.7
async-timeout==3.0.1
attrs==19.3.0
autobahn==20.6.1
Automat==20.2.0
backcall==0.2.0
bleach==3.1.5
Brotli==1.0.7
cachetools==4.1.1
certifi==2020.6.20
cffi>=1.8
channels==2.4.0
channels-redis==2.4.2
chardet==3.0.4
click==7.1.2
colorama==0.4.3
constantly==15.1.0
daphne==2.5.0
dash==1.13.3
dash-core-components==1.10.1
dash-html-components==1.0.3
dash-renderer==1.5.0
dash-table==4.8.1
decorator==4.4.2
defusedxml==0.6.0
distro==1.5.0
Django==3.0.6
django-filter==2.3.0
django-plotly-dash==1.4.1
django-redis==4.12.1
django-storages==1.10
djangorestframework==3.11.0
docutils==0.15.2
dpd-components==0.1.0
entrypoints==0.3
Flask==1.1.2
Flask-Compress==1.5.0
future==0.18.2
hiredis==1.0.1
hyperlink==19.0.0
idna==2.9
importlib-metadata==1.7.0
incremental==17.5.0
ipykernel==5.3.0
ipython==7.16.1
ipython-genutils==0.2.0
itsdangerous==1.1.0
jedi==0.17.1
Jinja2==2.11.2
jmespath==0.10.0
jsonschema==3.2.0
jupyter-client==6.1.5
jupyter-core==4.6.3
Markdown==3.2.2
MarkupSafe==1.1.1
mistune==0.8.4
msgpack==0.6.2
nbconvert==5.6.1
nbformat==5.0.7
notebook==6.0.3
numpy==1.19.0
packaging==20.4
pandas==1.0.5
pandocfilters==1.4.2
parso==0.7.0
pickleshare==0.7.5
plotly==4.8.1
prometheus-client==0.8.0
prompt-toolkit==3.0.5
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
Pygments==2.6.1
PyHamcrest==2.0.2
pyOpenSSL==19.1.0
pyparsing==2.4.7
pyrsistent==0.16.0
python-dateutil==2.8.1
pytz==2020.1
pyzmq==19.0.1
redis==3.5.3
requests==2.23.0
retrying==1.3.3
s3transfer==0.3.3
Send2Trash==1.5.0
service-identity==18.1.0
setuptools>=40.6.0
six==1.15.0
soupsieve==2.0.1
sqlparse==0.3.1
terminado==0.8.3
testpath==0.4.4
tornado==6.0.4
traitlets==4.3.3
Twisted==20.3.0
txaio==20.4.1
urllib3==1.25.9
wcwidth==0.2.5
webencodings==0.5.1
Werkzeug==1.0.1
wincertstore==0.2
world-bank-data==0.1.3
xlrd==1.2.0
zipp==3.1.0
zope.interface==5.1.0
uWSGI>=2.0.18,<2.1
gunicorn==20.0.4
Also updated my Dockerfile
Structure:
My Dockerfile (updated):
FROM python:3.8-alpine
ENV PATH="/scripts:${PATH}"
RUN pip3 install --upgrade pip
COPY /requirements.txt /requirements.txt
RUN apk add --update --no-cache --virtual .tmp gcc libc-dev linux-headers
RUN apk add --no-cache libressl-dev musl-dev libffi-dev && \
pip install --no-cache-dir cryptography>=2.8 && \
apk del libressl-dev musl-dev libffi-dev
RUN pip install -r /requirements.txt
RUN apk del .tmp
RUN mkdir /app
COPY ./MacroWebsite /app
WORKDIR /MacroWebsite
COPY ./scripts /scripts
RUN chmod +x /scripts/*
RUN mkdir -p /vol/web/media
RUN mkdir -p /vol/web/static
RUN adduser -D user
RUN chown -R user:user /vol
RUN chmod -R 755 /vol/web
USER user
CMD ["entrypoint.sh"]
docker compose.yml file:
services:
app:
build:
context: .
ports:
- "8000:8000"
volumes:
- ./MacroWebsite:/app
command: sh -c "python manage.py runserver 0.0.0.0:8000"
environment:
- DEBUG=1