Docker images not being pushed to ECR - amazon-web-services

I'm facing a bizarre problem. I'm pushing Docker images into ECR. 2 out of 4 images are pushed. The other 2 are left out for some reason.
My push file:
if [ "$GITLAB_BRANCH" == "staging" ] || \
[ "$GITLAB_BRANCH" == "production" ]
then
docker build $USERS_REPO -t $USERS:$COMMIT -f Dockerfile-$DOCKER_ENV
docker tag $USERS:$COMMIT $REPO/$USERS:$TAG
docker push $REPO/$USERS:$TAG #<-- SUCCESSFULLY PUSHED
docker build $USERS_DB_REPO -t $USERS_DB:$COMMIT -f Dockerfile
docker tag $USERS_DB:$COMMIT $REPO/$USERS_DB:$TAG
docker push $REPO/$USERS_DB:$TAG #<-- SUCCESSFULLY PUSHED
docker build $CLIENT_REPO -t $CLIENT:$COMMIT -f Dockerfile-prod --build-arg REACT_APP_USERS_SERVICE_URL=""
echo "CLIENT 1st LINE EXECUTED" # NOT EXECUTED
docker tag $CLIENT:$COMMIT $REPO/$CLIENT:$TAG # NOT EXECUTED
echo "CLIENT 2nd LINE EXECUTED" # NOT EXECUTED
docker push $REPO/$CLIENT:$TAG # NOT EXECUTED
docker build $SWAGGER_REPO -t $SWAGGER:$COMMIT -f Dockerfile-$DOCKER_ENV # NOT EXECUTED
docker tag $SWAGGER:$COMMIT $REPO/$SWAGGER:$TAG # NOT EXECUTED
docker push $REPO/$SWAGGER:$TAG # NOT EXECUTED
fi
Thanks to those debugging echo statements I've determined that Client and Swagger commands aren't being executed.
job log (sharing relevant output only):
Login Succeeded
Step 1/9 : FROM python:3.8.2-slim
---> ee07b1466448
Step 2/9 : RUN apt-get update && apt-get -y install netcat && apt-get clean
---> Using cache
---> b0a678c8b22d
Step 3/9 : WORKDIR /usr/src/app
---> Using cache
---> 25d4353ddd2c
Step 4/9 : COPY ./requirements.txt /usr/src/app/requirements.txt
---> 401a5620bb76
Step 5/9 : RUN pip install -r requirements.txt
---> Running in 86fac0967146
Collecting Werkzeug==0.16.1
Downloading Werkzeug-0.16.1-py2.py3-none-any.whl (327 kB)
Collecting coverage==4.5.3
Downloading coverage-4.5.3.tar.gz (384 kB)
Collecting flake8===3.7.7
Downloading flake8-3.7.7-py2.py3-none-any.whl (68 kB)
Collecting Flask==1.1.1
Downloading Flask-1.1.1-py2.py3-none-any.whl (94 kB)
Collecting flask-bcrypt==0.7.1
Downloading Flask-Bcrypt-0.7.1.tar.gz (5.1 kB)
Collecting flask-cors==3.0.7
Downloading Flask_Cors-3.0.7-py2.py3-none-any.whl (13 kB)
Collecting flask-debugtoolbar==0.10.1
Downloading Flask_DebugToolbar-0.10.1-py2.py3-none-any.whl (326 kB)
Collecting flask-migrate==2.4.0
Downloading Flask_Migrate-2.4.0-py2.py3-none-any.whl (13 kB)
Collecting Flask-RESTful==0.3.7
Downloading Flask_RESTful-0.3.7-py2.py3-none-any.whl (24 kB)
Collecting Flask-SQLAlchemy==2.3.2
Downloading Flask_SQLAlchemy-2.3.2-py2.py3-none-any.whl (16 kB)
Collecting Flask-Testing==0.7.1
Downloading Flask-Testing-0.7.1.tar.gz (43 kB)
Collecting gunicorn==20.0.4
Downloading gunicorn-20.0.4-py2.py3-none-any.whl (77 kB)
Collecting psycopg2-binary==2.8.4
Downloading psycopg2_binary-2.8.4-cp38-cp38-manylinux1_x86_64.whl (3.0 MB)
Collecting pyjwt==1.7.1
Downloading PyJWT-1.7.1-py2.py3-none-any.whl (18 kB)
Collecting pyflakes<2.2.0,>=2.1.0
Downloading pyflakes-2.1.1-py2.py3-none-any.whl (59 kB)
Collecting entrypoints<0.4.0,>=0.3.0
Downloading entrypoints-0.3-py2.py3-none-any.whl (11 kB)
Collecting pycodestyle<2.6.0,>=2.5.0
Downloading pycodestyle-2.5.0-py2.py3-none-any.whl (51 kB)
Collecting mccabe<0.7.0,>=0.6.0
Downloading mccabe-0.6.1-py2.py3-none-any.whl (8.6 kB)
Collecting click>=5.1
Downloading click-7.1.1-py2.py3-none-any.whl (82 kB)
Collecting itsdangerous>=0.24
Downloading itsdangerous-1.1.0-py2.py3-none-any.whl (16 kB)
Collecting Jinja2>=2.10.1
Downloading Jinja2-2.11.1-py2.py3-none-any.whl (126 kB)
Collecting bcrypt
Downloading bcrypt-3.1.7-cp34-abi3-manylinux1_x86_64.whl (56 kB)
Collecting Six
Downloading six-1.14.0-py2.py3-none-any.whl (10 kB)
Collecting Blinker
Downloading blinker-1.4.tar.gz (111 kB)
Collecting alembic>=0.7
Downloading alembic-1.4.2.tar.gz (1.1 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Collecting aniso8601>=0.82
Downloading aniso8601-8.0.0-py2.py3-none-any.whl (43 kB)
Collecting pytz
Downloading pytz-2019.3-py2.py3-none-any.whl (509 kB)
Collecting SQLAlchemy>=0.8.0
Downloading SQLAlchemy-1.3.15.tar.gz (6.1 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Requirement already satisfied: setuptools>=3.0 in /usr/local/lib/python3.8/site-packages (from gunicorn==20.0.4->-r requirements.txt (line 12)) (45.2.0)
Collecting MarkupSafe>=0.23
Downloading MarkupSafe-1.1.1-cp38-cp38-manylinux1_x86_64.whl (32 kB)
Collecting cffi>=1.1
Downloading cffi-1.14.0-cp38-cp38-manylinux1_x86_64.whl (409 kB)
Collecting python-editor>=0.3
Downloading python_editor-1.0.4-py3-none-any.whl (4.9 kB)
Collecting python-dateutil
Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Collecting Mako
Downloading Mako-1.1.2-py2.py3-none-any.whl (75 kB)
Collecting pycparser
Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)
Building wheels for collected packages: coverage, flask-bcrypt, Flask-Testing, Blinker, alembic, SQLAlchemy
Building wheel for coverage (setup.py): started
Building wheel for coverage (setup.py): finished with status 'done'
Created wheel for coverage: filename=coverage-4.5.3-py3-none-any.whl size=170336 sha256=038d3ae43b6607fdfd80e1d69f79420bd823507f7be1fc20bdd16d2cdf01d518
Stored in directory: /root/.cache/pip/wheels/b0/4c/d7/9db997336a1ea6749f3b3b1b9edea6f6665ee86f58ae1e5b1b
Building wheel for flask-bcrypt (setup.py): started
Building wheel for flask-bcrypt (setup.py): finished with status 'done'
Created wheel for flask-bcrypt: filename=Flask_Bcrypt-0.7.1-py3-none-any.whl size=5010 sha256=62300cc512e7c33a42f41ca20120672f7b6ff54c5009a208c32b3fc50bf4da62
Stored in directory: /root/.cache/pip/wheels/8a/d9/0e/dc762c4ebc76f581397a2e25991db6efd148640b5616ab9210
Building wheel for Flask-Testing (setup.py): started
Building wheel for Flask-Testing (setup.py): finished with status 'done'
Created wheel for Flask-Testing: filename=Flask_Testing-0.7.1-py3-none-any.whl size=8167 sha256=972152da9797e69bc3682dd259120d95076afdf31e1f3f6dca9e68cb745b84f8
Stored in directory: /root/.cache/pip/wheels/1e/61/04/028fc73af661e18862396627606c5898a5da45f13ac0e37711
Building wheel for Blinker (setup.py): started
Building wheel for Blinker (setup.py): finished with status 'done'
Created wheel for Blinker: filename=blinker-1.4-py3-none-any.whl size=13452 sha256=bba96e4a53181a424212eaa71d27e74fa0d13c3914867e58b0484a0a60ecd377
Stored in directory: /root/.cache/pip/wheels/b7/a5/68/fe632054a5eadd531c7a49d740c50eb6adfbeca822b4eab8d4
Building wheel for alembic (PEP 517): started
Building wheel for alembic (PEP 517): finished with status 'done'
Created wheel for alembic: filename=alembic-1.4.2-py2.py3-none-any.whl size=159543 sha256=298ba2526878708a54b8db0ad2ab5ef05be4438963dd09bec1a50b59c8a15508
Stored in directory: /root/.cache/pip/wheels/70/08/70/cea787a7e95817b831469fa42af076046e55a05f7c94657463
Building wheel for SQLAlchemy (PEP 517): started
Building wheel for SQLAlchemy (PEP 517): finished with status 'done'
Created wheel for SQLAlchemy: filename=SQLAlchemy-1.3.15-cp38-cp38-linux_x86_64.whl size=1183124 sha256=50418d7071fd37b2db91f19a375389422fdc56895072af53df4a6665537d893b
Stored in directory: /root/.cache/pip/wheels/d1/0c/78/33448c81fd8e458d60897744f30462ca39e682637ec9591c0d
Successfully built coverage flask-bcrypt Flask-Testing Blinker alembic SQLAlchemy
Installing collected packages: Werkzeug, coverage, pyflakes, entrypoints, pycodestyle, mccabe, flake8, click, itsdangerous, MarkupSafe, Jinja2, Flask, pycparser, cffi, Six, bcrypt, flask-bcrypt, flask-cors, Blinker, flask-debugtoolbar, SQLAlchemy, python-editor, python-dateutil, Mako, alembic, Flask-SQLAlchemy, flask-migrate, aniso8601, pytz, Flask-RESTful, Flask-Testing, gunicorn, psycopg2-binary, pyjwt
Successfully installed Blinker-1.4 Flask-1.1.1 Flask-RESTful-0.3.7 Flask-SQLAlchemy-2.3.2 Flask-Testing-0.7.1 Jinja2-2.11.1 Mako-1.1.2 MarkupSafe-1.1.1 SQLAlchemy-1.3.15 Six-1.14.0 Werkzeug-0.16.1 alembic-1.4.2 aniso8601-8.0.0 bcrypt-3.1.7 cffi-1.14.0 click-7.1.1 coverage-4.5.3 entrypoints-0.3 flake8-3.7.7 flask-bcrypt-0.7.1 flask-cors-3.0.7 flask-debugtoolbar-0.10.1 flask-migrate-2.4.0 gunicorn-20.0.4 itsdangerous-1.1.0 mccabe-0.6.1 psycopg2-binary-2.8.4 pycodestyle-2.5.0 pycparser-2.20 pyflakes-2.1.1 pyjwt-1.7.1 python-dateutil-2.8.1 python-editor-1.0.4 pytz-2019.3
Removing intermediate container 86fac0967146
---> 24e9fd372978
Step 6/9 : COPY ./entrypoint.sh /usr/src/app/entrypoint-prod.sh
---> a8a8ff286b9a
Step 7/9 : RUN chmod +x /usr/src/app/entrypoint-prod.sh
---> Running in 3e5271e99947
Removing intermediate container 3e5271e99947
---> ed979b6a92d2
Step 8/9 : COPY . /usr/src/app
---> 98ae33e1a57f
Step 9/9 : CMD ["/usr/src/app/entrypoint-prod.sh"]
---> Running in 47ec0411fa6f
Removing intermediate container 47ec0411fa6f
---> aa4f69380842
Successfully built aa4f69380842
Successfully tagged test-driven-users:7cd9fc49
The push refers to repository [274725968600.dkr.ecr.eu-west-2.amazonaws.com/test-driven-users]
84b82b2ee3ff: Preparing
863cf2890ceb: Preparing
863cf2890ceb: Preparing
71378740a723: Preparing
116445b56805: Preparing
3e98b52f064e: Preparing
241d1d8b8b7e: Preparing
fe108eef54ea: Preparing
df4dc71f749c: Preparing
64b4e3ecc0d6: Preparing
bdc3a0723efa: Preparing
f2cb0ecef392: Preparing
241d1d8b8b7e: Waiting
fe108eef54ea: Waiting
df4dc71f749c: Waiting
64b4e3ecc0d6: Waiting
bdc3a0723efa: Waiting
f2cb0ecef392: Waiting
116445b56805: Pushed
863cf2890ceb: Pushed
84b82b2ee3ff: Pushed
3e98b52f064e: Pushed
df4dc71f749c: Layer already exists
64b4e3ecc0d6: Layer already exists
fe108eef54ea: Layer already exists
bdc3a0723efa: Layer already exists
f2cb0ecef392: Layer already exists
71378740a723: Pushed
241d1d8b8b7e: Pushed
production: digest: sha256:f14a77a6e8555ecb29c5d7cd1b1435f2835e43c483ae530ec7e877974bc6b32a size: 2830
Users pushed
Step 1/2 : FROM postgres:12.2-alpine
---> 155381193772
Step 2/2 : ADD create.sql /docker-entrypoint-initdb.d
---> 21a0338e2cd6
Successfully built 21a0338e2cd6
Successfully tagged test-driven-users_db:7cd9fc49
The push refers to repository [274725968600.dkr.ecr.eu-west-2.amazonaws.com/test-driven-users_db]
0d9977ee4514: Preparing
2552a4140be9: Preparing
4a517dd4afb0: Preparing
08185ac708af: Preparing
8c2dd7a8ecdf: Preparing
230e876ebf83: Preparing
fe9df245e483: Preparing
e384dedb3f12: Preparing
5216338b40a7: Preparing
230e876ebf83: Waiting
fe9df245e483: Waiting
e384dedb3f12: Waiting
5216338b40a7: Waiting
2552a4140be9: Layer already exists
4a517dd4afb0: Layer already exists
08185ac708af: Layer already exists
8c2dd7a8ecdf: Layer already exists
230e876ebf83: Layer already exists
fe9df245e483: Layer already exists
e384dedb3f12: Layer already exists
5216338b40a7: Layer already exists
0d9977ee4514: Pushed
production: digest: sha256:8ff80fd2a71f71524ea3c293094099c6d110ad60c5118654bd899a1ef78f8b8f size: 2192
Database pushed
Step 1/20 : FROM node:11.12.0-alpine as builder
---> 09084e4ff58d
Step 2/20 : WORKDIR /usr/src/app
---> Using cache
---> 2a5d0819135f
Step 3/20 : RUN apk add --no-cache --virtual .gyp python make g++
---> Using cache
---> 56864a4e5367
Step 4/20 : ENV PATH /usr/src/app/node_modules/.bin:$PATH
---> Using cache
---> 0e0bf35b6ecc
Step 5/20 : COPY package.json /usr/src/app/package.json
---> 8616da17869a
Step 6/20 : COPY package-lock.json /usr/src/app/package-lock.json
---> 7d43a249c366
Step 7/20 : RUN npm install --no-optional
---> Running in 11527112e824
> cypress#4.1.0 postinstall /usr/src/app/node_modules/cypress
> node index.js --exec install
Installing Cypress (version: 4.1.0)
[11:00:49] Downloading Cypress [started]
[11:00:49] Downloading Cypress 0% 0s [title changed]
…
…
[11:00:51] Downloading Cypress 83% 0s [title changed]
[11:00:51] Downloading Cypress 98% 0s [title changed]
[11:00:52] Downloaded Cypress [title changed]
[11:00:52] Downloaded Cypress [completed]
[11:00:52] Unzipping Cypress [started]
[11:00:53] Unzipping Cypress 0% 0s [title changed]
[11:00:54] Unzipping Cypress 1% 161s [title changed]
[11:00:54] Unzipping Cypress 1% 162s [title changed]
[11:00:54] Unzipping Cypress 1% 163s [title changed]
[11:00:55] Unzipping Cypress 1% 334s [title changed]
[11:00:55] Unzipping Cypress 1% 335s [title changed]
…
…
[11:01:06] Unzipping Cypress 9% 140s [title changed]
[11:01:08] Unzipping Cypress 9% 164s [title changed]
[11:01:08] Unzipping Cypress 100% 0s [title changed]
[11:01:08] Unzipped Cypress [title changed]
[11:01:08] Unzipped Cypress [completed]
[11:01:08] Finishing Installation [started]
[11:01:08] Finished Installation /root/.cache/Cypress/4.1.0 [title changed]
[11:01:08] Finished Installation /root/.cache/Cypress/4.1.0 [completed]
You can now open Cypress by running: node_modules/.bin/cypress open
https://on.cypress.io/installing-cypress
added 2034 packages from 768 contributors and audited 38602 packages in 76.256s
found 1073 vulnerabilities (1058 low, 14 moderate, 1 high)
run `npm audit fix` to fix them, or `npm audit` for details
Saving cache
00:02
Uploading artifacts for successful job
00:02
Job succeeded
As you can see it exits out with "Job succeeded" with no errors indicating why it couldn't run the other 2 docker images.
Any suggestions ?
Update:
including set -euo pipefail revealed: line 4: GITLAB_PULL_REQUEST: unbound variable
relevant code:
#!/bin/sh
set -euo pipefail
if [ -z "$GITLAB_PULL_REQUEST" ] || [ "$GITLAB_PULL_REQUEST" == "false" ] # <-- LINE 4
then
if [[ "$GITLAB_BRANCH" == "staging" ]]; then
export DOCKER_ENV=stage
elif [[ "$GITLAB_BRANCH" == "production" ]]; then
export DOCKER_ENV=prod
fi
if [ "$GITLAB_BRANCH" == "staging" ] || \
[ "$GITLAB_BRANCH" == "production" ]
then
...
...

You're assuming that the shell script will stop if one of the steps fails. Sadly, shell scripts don't do that: they'll happily keep running even if a command fails.
So it may be that one of the build stages is failing.
For bash, you can do set -euo pipefail to get slightly more reasonable behavior. See http://redsymbol.net/articles/unofficial-bash-strict-mode/ for details.

Related

Heroku reject push project

i try to publish my python project but i have some issues can you help me ? i have requirements.txt also i add my git profile this is my first time with heroku i don't understand what is wrong i add my project on git repository and main branch i use python 3 this is my python project my project files and git files are in same level i tried something is i found on internet but it not worked for me
and this is heroku error :
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/python
-----> Python app detected
-----> No Python version was specified. Using the buildpack default: python-3.10.4
To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
-----> Installing python-3.10.4
-----> Installing pip 22.0.4, setuptools 60.10.0 and wheel 0.37.1
-----> Installing SQLite3
-----> Installing requirements with pip
Collecting APScheduler==3.9.1
Downloading APScheduler-3.9.1-py2.py3-none-any.whl (59 kB)
Collecting asgiref==3.5.0
Downloading asgiref-3.5.0-py3-none-any.whl (22 kB)
Collecting beautifulsoup4==4.10.0
Downloading beautifulsoup4-4.10.0-py3-none-any.whl (97 kB)
Collecting bs4==0.0.1
Downloading bs4-0.0.1.tar.gz (1.1 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting certifi==2021.10.8
Downloading certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Collecting cffi==1.15.0
Downloading cffi-1.15.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (446 kB)
Collecting charset-normalizer==2.0.12
Downloading charset_normalizer-2.0.12-py3-none-any.whl (39 kB)
Collecting cryptography==36.0.1
Downloading cryptography-36.0.1-cp36-abi3-manylinux_2_24_x86_64.whl (3.6 MB)
Collecting distlib==0.3.4
Downloading distlib-0.3.4-py2.py3-none-any.whl (461 kB)
Collecting Django==2.2.27
Downloading Django-2.2.27-py3-none-any.whl (7.5 MB)
Collecting django-filter==21.1
Downloading django_filter-21.1-py3-none-any.whl (81 kB)
Collecting django-js-asset==2.0.0
Downloading django_js_asset-2.0.0-py3-none-any.whl (4.9 kB)
Collecting django-mptt==0.13.4
Downloading django_mptt-0.13.4-py3-none-any.whl (137 kB)
Collecting djangorestframework==3.13.1
Downloading djangorestframework-3.13.1-py3-none-any.whl (958 kB)
Collecting drf-flex-fields==0.9.7
Downloading drf-flex-fields-0.9.7.tar.gz (28 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting drf-renderer-xlsx==0.4.5
Downloading drf_renderer_xlsx-0.4.5-py3-none-any.whl (11 kB)
Collecting et-xmlfile==1.1.0
Downloading et_xmlfile-1.1.0-py3-none-any.whl (4.7 kB)
Collecting filelock==3.6.0
Downloading filelock-3.6.0-py3-none-any.whl (10.0 kB)
Collecting gunicorn==20.1.0
Downloading gunicorn-20.1.0-py3-none-any.whl (79 kB)
Collecting idna==3.3
Downloading idna-3.3-py3-none-any.whl (61 kB)
Collecting ldap3==2.9.1
Downloading ldap3-2.9.1-py2.py3-none-any.whl (432 kB)
Collecting openpyxl==3.0.9
Downloading openpyxl-3.0.9-py2.py3-none-any.whl (242 kB)
Collecting Pillow==9.0.1
Downloading Pillow-9.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.3 MB)
Collecting platformdirs==2.5.1
Downloading platformdirs-2.5.1-py3-none-any.whl (14 kB)
Collecting pyasn1==0.4.8
Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
Collecting pycparser==2.21
Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
Collecting python-dateutil==2.8.2
Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting pytz==2022.1
Downloading pytz-2022.1-py2.py3-none-any.whl (503 kB)
Collecting pytz-deprecation-shim==0.1.0.post0
Downloading pytz_deprecation_shim-0.1.0.post0-py2.py3-none-any.whl (15 kB)
Collecting requests==2.27.1
Downloading requests-2.27.1-py2.py3-none-any.whl (63 kB)
Collecting six==1.16.0
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting soupsieve==2.3.1
Downloading soupsieve-2.3.1-py3-none-any.whl (37 kB)
Collecting sqlparse==0.4.2
Downloading sqlparse-0.4.2-py3-none-any.whl (42 kB)
Collecting tzdata==2022.1
Downloading tzdata-2022.1-py2.py3-none-any.whl (339 kB)
Collecting tzlocal==4.1
Downloading tzlocal-4.1-py3-none-any.whl (19 kB)
Collecting urllib3==1.26.9
Downloading urllib3-1.26.9-py2.py3-none-any.whl (138 kB)
Collecting virtualenv==20.14.0
Downloading virtualenv-20.14.0-py2.py3-none-any.whl (8.8 MB)
Collecting whitenoise==6.0.0
Downloading whitenoise-6.0.0-py3-none-any.whl (19 kB)
Building wheels for collected packages: bs4, drf-flex-fields
Building wheel for bs4 (setup.py): started
Building wheel for bs4 (setup.py): finished with status 'done'
Created wheel for bs4: filename=bs4-0.0.1-py3-none-any.whl size=1272 sha256=1b9aa0ae1eb53ab61439cc713b4cd3634e11eacadde3f580901099bdff9485c5
Stored in directory: /tmp/pip-ephem-wheel-cache-n0iong8p/wheels/25/42/45/b773edc52acb16cd2db4cf1a0b47117e2f69bb4eb300ed0e70
Building wheel for drf-flex-fields (setup.py): started
Building wheel for drf-flex-fields (setup.py): finished with status 'done'
Created wheel for drf-flex-fields: filename=drf_flex_fields-0.9.7-py3-none-any.whl size=14682 sha256=83b04e19d2af8aa588e19a76d2d51e53fd5e0ae3b91972f0bf96dc98ffa3c4b6
Stored in directory: /tmp/pip-ephem-wheel-cache-n0iong8p/wheels/d1/ae/ef/2a1b188db93bb648757e281df437793c2a389ae01ef599effb
Successfully built bs4 drf-flex-fields
Installing collected packages: pytz, pyasn1, drf-flex-fields, distlib, certifi, whitenoise, urllib3, tzdata, sqlparse, soupsieve, six, pycparser, platformdirs, Pillow, ldap3, idna, gunicorn, filelock, et-xmlfile, charset-normalizer, asgiref, virtualenv, requests, pytz-deprecation-shim, python-dateutil, openpyxl, Django, cffi, beautifulsoup4, tzlocal, djangorestframework, django-js-asset, django-filter, cryptography, bs4, drf-renderer-xlsx, django-mptt, APScheduler
Successfully installed APScheduler-3.9.1 Django-2.2.27 Pillow-9.0.1 asgiref-3.5.0 beautifulsoup4-4.10.0 bs4-0.0.1 certifi-2021.10.8 cffi-1.15.0 charset-normalizer-2.0.12 cryptography-36.0.1 distlib-0.3.4 django-filter-21.1 django-js-asset-2.0.0 django-mptt-0.13.4 djangorestframework-3.13.1 drf-flex-fields-0.9.7 drf-renderer-xlsx-0.4.5 et-xmlfile-1.1.0 filelock-3.6.0 gunicorn-20.1.0 idna-3.3 ldap3-2.9.1 openpyxl-3.0.9 platformdirs-2.5.1 pyasn1-0.4.8 pycparser-2.21 python-dateutil-2.8.2 pytz-2022.1 pytz-deprecation-shim-0.1.0.post0 requests-2.27.1 six-1.16.0 soupsieve-2.3.1 sqlparse-0.4.2 tzdata-2022.1 tzlocal-4.1 urllib3-1.26.9 virtualenv-20.14.0 whitenoise-6.0.0
-----> $ python manage.py collectstatic --noinput
Traceback (most recent call last):
File "/tmp/build_94cceabe/manage.py", line 21, in <module>
main()
File "/tmp/build_94cceabe/manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.10/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.10/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 188, in handle
collected = self.collect()
File "/app/.heroku/python/lib/python3.10/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 114, in collect
handler(path, prefixed_path, storage)
File "/app/.heroku/python/lib/python3.10/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 342, in copy_file
if not self.delete_file(path, prefixed_path, source_storage):
File "/app/.heroku/python/lib/python3.10/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 249, in delete_file
if self.storage.exists(prefixed_path):
File "/app/.heroku/python/lib/python3.10/site-packages/django/core/files/storage.py", line 324, in exists
return os.path.exists(self.path(name))
File "/app/.heroku/python/lib/python3.10/site-packages/django/contrib/staticfiles/storage.py", line 44, in path
raise ImproperlyConfigured("You're using the staticfiles app "
django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.
! Error while running '$ python manage.py collectstatic --noinput'.
See traceback above for details.
You may need to update application code to resolve this error.
Or, you can disable collectstatic for this application:
$ heroku config:set DISABLE_COLLECTSTATIC=1
https://devcenter.heroku.com/articles/django-assets
! Push rejected, failed to compile Python app.
! Push failed
You must setting the STATIC_ROOT when the DEBUG=False or when production step in the settings.py
example
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
and make sure to put Procfile in the root of project
for completed step you can access here
Procfile contain
web: gunicorn <yourapp>.wsgi --log-file -
Good luck and keep coding

docker container built and running but not working

My name is omar. I have a docker image and container for a project that I have just created and ran. So i am currently trying to test it on my local machine before pushing it to an online environment. I built it with no previous cache and it build the new docker which is running online. Why is it not working in my browser. Here is what I have.
(MySplit) omars-mbp:mysplit omarjandali$ docker build --no-cache -t validation_test_1 .
Sending build context to Docker daemon 56.07MB
Step 1/7 : FROM python:3
---> 79e1dc9af1c1
Step 2/7 : WORKDIR users/
Removing intermediate container 7030351beb91
---> 30ac3f4ccbae
Step 3/7 : COPY requirements.txt ./
---> 57cbbd7335ab
Step 4/7 : EXPOSE 80
---> Running in 592407a176ff
Removing intermediate container 592407a176ff
---> 523945ea529f
Step 5/7 : RUN pip install -r requirements.txt
---> Running in 48347f772fbe
Collecting Django==1.11.5 (from -r requirements.txt (line 1))
Downloading https://files.pythonhosted.org/packages/18/2d/b477232dd619d81766064cd07ba5b35e956ff8a8c5c5d41754e0392b96e3/Django-1.11.5-py2.py3-none-any.whl (6.9MB)
Collecting gunicorn==19.7 (from -r requirements.txt (line 2))
Downloading https://files.pythonhosted.org/packages/96/4b/bc4bc2dad60defaa3f7d8590dc51331a225a5399380c161047c1224cd86d/gunicorn-19.7.0-py2.py3-none-any.whl (112kB)
Collecting django-localflavor==1.5.3 (from -r requirements.txt (line 3))
Downloading https://files.pythonhosted.org/packages/da/47/69e53f69fb50a38766aa929c1f81fd2e6315edc7f3945174ead24ffcf6df/django-localflavor-1.5.3.tar.gz (4.7MB)
Collecting synapse_pay_rest_native==3.1.1 (from -r requirements.txt (line 4))
Downloading https://files.pythonhosted.org/packages/43/27/b73d83dd50d4dfec1680d22896b800ddbb6bf8fb3f3a1755a916a6e4f732/synapse_pay_rest_native-3.1.1.tar.gz
Collecting pytz (from Django==1.11.5->-r requirements.txt (line 1))
Downloading https://files.pythonhosted.org/packages/dc/83/15f7833b70d3e067ca91467ca245bae0f6fe56ddc7451aa0dc5606b120f2/pytz-2018.4-py2.py3-none-any.whl (510kB)
Collecting requests (from synapse_pay_rest_native==3.1.1->-r requirements.txt (line 4))
Downloading https://files.pythonhosted.org/packages/49/df/50aa1999ab9bde74656c2919d9c0c085fd2b3775fd3eca826012bef76d8c/requests-2.18.4-py2.py3-none-any.whl (88kB)
Collecting chardet<3.1.0,>=3.0.2 (from requests->synapse_pay_rest_native==3.1.1->-r requirements.txt (line 4))
Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
Collecting idna<2.7,>=2.5 (from requests->synapse_pay_rest_native==3.1.1->-r requirements.txt (line 4))
Downloading https://files.pythonhosted.org/packages/27/cc/6dd9a3869f15c2edfab863b992838277279ce92663d334df9ecf5106f5c6/idna-2.6-py2.py3-none-any.whl (56kB)
Collecting urllib3<1.23,>=1.21.1 (from requests->synapse_pay_rest_native==3.1.1->-r requirements.txt (line 4))
Downloading https://files.pythonhosted.org/packages/63/cb/6965947c13a94236f6d4b8223e21beb4d576dc72e8130bd7880f600839b8/urllib3-1.22-py2.py3-none-any.whl (132kB)
Collecting certifi>=2017.4.17 (from requests->synapse_pay_rest_native==3.1.1->-r requirements.txt (line 4))
Downloading https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl (150kB)
Building wheels for collected packages: django-localflavor, synapse-pay-rest-native
Running setup.py bdist_wheel for django-localflavor: started
Running setup.py bdist_wheel for django-localflavor: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/36/41/a8/30c023fe29300f1a19d0520aaff1faf9e4c7ab176c53913ab5
Running setup.py bdist_wheel for synapse-pay-rest-native: started
Running setup.py bdist_wheel for synapse-pay-rest-native: finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/33/93/7f/6bd8dd39a1c22e2ef85a259a45e603dff2b0ab4d6209a7a976
Successfully built django-localflavor synapse-pay-rest-native
Installing collected packages: pytz, Django, gunicorn, django-localflavor, chardet, idna, urllib3, certifi, requests, synapse-pay-rest-native
Successfully installed Django-1.11.5 certifi-2018.4.16 chardet-3.0.4 django-localflavor-1.5.3 gunicorn-19.7.0 idna-2.6 pytz-2018.4 requests-2.18.4 synapse-pay-rest-native-3.1.1 urllib3-1.22
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Removing intermediate container 48347f772fbe
---> 5749b63a2fef
Step 6/7 : COPY . .
---> 7754d9db1f38
Step 7/7 : CMD ["python", "manage.py", "runserver"]
---> Running in 362648ae0426
Removing intermediate container 362648ae0426
---> c26bf2de11b4
Successfully built c26bf2de11b4
Successfully tagged validation_test_1:latest
(MySplit) omars-mbp:mysplit omarjandali$ docker run -d -P validation_test_1:latest
b038c688ba4e681c03d8e093cf630a564d2f7cea27812b55dd0d1c33aa0f27b4
(MySplit) omars-mbp:mysplit omarjandali$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b038c688ba4e validation_test_1:latest "python manage.py ru…" 5 seconds ago Up 4 seconds 0.0.0.0:32768->80/tcp zealous_mcnulty
(MySplit) omars-mbp:mysplit omarjandali$
I have tried the following localhost:32768 and 127.0.0.1:32768 does anyone know why this is happening.
I have allowed all hosts in my django project.
dockerfile
FROM python:3
WORKDIR users/
COPY requirements.txt ./
EXPOSE 80
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "manage.py", "runserver"]
This will be because Django's runserver accepts connections from 127.0.0.1 only by default and when you hit localhost:32768 from your browser the connection isn't coming from 127.0.0.1 / localhost, but from your actual host IP.
Change your CMD to:
CMD ["python", "manage.py", "runserver", "0.0.0.0:80"]

Confusing error while deploying Django on Heroku: No module named site

I've got two Heroku apps, running on the same codebase. The 1st is used as staging env and it works as expected (it auto deploys the devel branch) and the 2nd is used as the production app (auto deploying the master branch).
Today I did a minor code-level change and submitted a PR from devel to master and merged it. From that moment, heroku cannot deploy my master branch in production.
Full logs for this as given by heroku build log:
----->
Python app detected
-----> Uninstalling stale dependencies
Uninstalling django-elasticsearch-0.5:
Successfully uninstalled django-elasticsearch-0.5
Uninstalling pymongo-3.3.0:
Successfully uninstalled pymongo-3.3.0
$ pip install -r requirements.txt
Collecting git+https://github.com/liberation/django_elasticsearch.git (from -r requirements.txt (line 69))
Cloning https://github.com/liberation/django_elasticsearch.git to /tmp/pip-ZPaLWp-build
Collecting Delorean==0.6.0 (from -r requirements.txt (line 10))
Downloading Delorean-0.6.0.tar.gz
Collecting humanize==0.5.1 (from -r requirements.txt (line 37))
Downloading humanize-0.5.1.tar.gz
Collecting pynamodb==2.0.2 (from -r requirements.txt (line 46))
Downloading pynamodb-2.0.2-py2.py3-none-any.whl (73kB)
Collecting tzlocal==1.3 (from -r requirements.txt (line 63))
Downloading tzlocal-1.3.tar.gz
Installing collected packages: humanize, tzlocal, Delorean, django-traffic, pynamodb, django-elasticsearch
Running setup.py install for humanize: started
Running setup.py install for humanize: finished with status 'done'
Running setup.py install for tzlocal: started
Running setup.py install for tzlocal: finished with status 'done'
Running setup.py install for Delorean: started
Running setup.py install for Delorean: finished with status 'done'
Running setup.py install for django-elasticsearch: started
Running setup.py install for django-elasticsearch: finished with status 'done'
Successfully installed Delorean-0.6.0 django-elasticsearch-0.5 django-traffic-1.2.4 humanize-0.5.1 pynamodb-2.0.2 tzlocal-1.3
-----> Django app detected
-----> Running Django migrations
ImportError: No module named site
! Push rejected, failed to compile Django app.
! Push failed
Well, as fas as I know, there's no "site" module/app or anything in my code, so I cannot understand what's the problem in this case. I remind you, the devel branch auto deploys as expected in the respective Heroku app.
Any ideas?

Manually remove Python package on Heroku

I was running heroku push master, and got this:
----- Python app detected
----- No runtime.txt provided; assuming python-2.7.3.
----- Using Python runtime (python-2.7.3)
----- Installing dependencies using Pip (1.2.1)
Downloading/unpacking Django-1.5c2 from https://www.djangoproject.com/download/1.5c2/tarball (from -r
requirements.txt (line 1))
Cannot determine compression type for file /tmp/pip-rYIGHS-unpack/tarball.ksh
Running setup.py egg_info for package Django-1.5c2
Installing collected packages: Django-1.5c2
Running setup.py install for Django-1.5c2
changing mode of build/scripts-2.7/django-admin.py from 600 to 755
changing mode of /app/.heroku/python/bin/django-admin.py to 755
========
WARNING!
========
You have just installed Django over top of an existing
installation, without removing it first. Because of this,
your install may now include extraneous files from a
previous version that have since been removed from
Django. This is known to cause a variety of problems. You
should manually remove the
/app/.heroku/python/lib/python2.7/site-packages/django
directory and re-install Django.
Successfully installed Django-1.5c2
How can I remove the previous Django package?
UPDATE:
My requirements.txt:
https://www.djangoproject.com/download/1.5c2/tarball/**#egg=django**
South==0.7.6
argparse==1.2.1
distribute==0.6.24
dj-database-url==0.2.1
psycopg2==2.4.6
wsgiref==0.1.2
PIL==1.1.7
The text in bold fixed the above warning.
UPDATE 2:
Since Django 1.5 was officially released, I just used pip freeze:
Django==1.5
South==0.7.6
argparse==1.2.1
distribute==0.6.24
dj-database-url==0.2.1
psycopg2==2.4.6
wsgiref==0.1.2
PIL==1.1.7
I've had problems where Heroku caches broken packages and there's no way to get them out. The Python buildpack should have some kind of support for flushing this cache (CACHE_DIR), but it does not.
There is a workaround: follow these instructions to change your Python runtime to, for instance, 3.3.0 (it doesn't matter if your app actually supports Python 3 or not). Then change it back to the default. The act of changing your Python runtime and then deploying will force the buildpack to totally erase the cache. As far as I know this is the only practical way to erase the cache at the moment.
Push current virtenv package to file
pip freeze > requirements.txt
Commit
git commit -am 'update packages'
And push to heroku
git push heroku
Then heroku will rebuild the environment
Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (13/13), 1.26 KiB, done.
Total 13 (delta 3), reused 0 (delta 0)
-----> Python app detected
-----> No runtime.txt provided; assuming python-2.7.3.
-----> Preparing Python runtime (python-2.7.3)
-----> Installing Distribute (0.6.34)
-----> Installing Pip (1.2.1)
-----> Installing dependencies using Pip (1.2.1)
Downloading/unpacking Flask==0.9 (from -r requirements.txt (line 1))
Running setup.py egg_info for package Flask
Thought I removed the faulting package and all other packages that depends on it but nope. Each time I deploy I keep getting an error. Finally I somehow striped out all other packages that depends on the faulting package and everything worked perfectly. Hope somebody will find this useful

django-sha2 not installing on heroku server

Im having problems deploying my django app to heroku
in the first part, heroku's push fails when it could not find any downloads for django-sha2==0.4 , however when i do pip install on my computer locally, it works
hh:djangoherokutest Kinnovate$ git push heroku master
Counting objects: 12, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 958 bytes, done.
Total 10 (delta 7), reused 0 (delta 0)
-----> Heroku receiving push
-----> Python/Django app detected
-----> Preparing virtualenv version 1.7
New python executable in ./bin/python
Installing distribute..............................................................................................................................................................................................done.
Installing pip...............done.
Overwriting ./bin/activate with new content
Overwriting ./bin/activate.fish with new content
Overwriting ./bin/activate.csh with new content
-----> Activating virtualenv
-----> Installing dependencies using pip version 1.0.2
Downloading/unpacking git+https://github.com/django/django.git (from -r requirements.txt (line 4))
Cloning https://github.com/django/django.git to /tmp/pip-Jvyfwt-build
Running setup.py egg_info for package from git+https://github.com/django/django.git
Requirement already satisfied (use --upgrade to upgrade): py-bcrypt==0.2 in ./lib/python2.7/site-packages (from -r requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): ipython==0.12 in ./lib/python2.7/site-packages (from -r requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): Flask==0.8 in ./lib/python2.7/site-packages (from -r requirements.txt (line 3))
Downloading/unpacking psycopg2==2.4.2 (from -r requirements.txt (line 5))
Running setup.py egg_info for package psycopg2
no previously-included directories found matching 'doc/src/_build'
Requested psycopg2==2.4.2 (from -r requirements.txt (line 5)), but installing version 2.4.4
Downloading/unpacking django-sha2==0.4 (from -r requirements.txt (line 6))
Could not find any downloads that satisfy the requirement django-sha2==0.4 (from -r requirements.txt (line 6))
No distributions at all found for django-sha2==0.4 (from -r requirements.txt (line 6))
Storing complete log in /app/.pip/pip.log
! Heroku push rejected, failed to compile Python/django app
To git#heroku.com:growing-mountain-9962.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:growing-mountain-9962.git'
hh:djangoherokutest Kinnovate$ pip install django-sha2
Requirement already satisfied (use --upgrade to upgrade): django-sha2 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django_sha2-0.4-py2.7.egg
Requirement already satisfied (use --upgrade to upgrade): Django>=1.2 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from django-sha2)
Cleaning up...
how do i fix this?
Try putting
git+https://github.com/fwenzel/django-sha2.git
instead of
django-sha2==0.4
in the requirements.txt. This will link straight to the package.