When I build my Debian
image from docker-compose, with the command $ docker-compose -f docker-compose-dev.yml build web
, like so:
docker-compose-fev.yml
services:
web:
build:
context: ./services/web
dockerfile: Dockerfile-dev
volumes:
- './services/web:/usr/src/app'
ports:
- 5001:5000
environment:
- FLASK_ENV=development
- APP_SETTINGS=project.config.DevelopmentConfig
- DATABASE_URL=postgres://postgres:postgres@web-db:5432/web_dev
- DATABASE_TEST_URL=postgres://postgres:postgres@web-db:5432/web_test
- SECRET_KEY=my_precious
depends_on:
- web-db
- redis
As though it appears to build all packages successfully, I'm getting:
web_1| /usr/src/app/entrypoint.sh: 5: /usr/src/app/entrypoint.sh: nc: not found
If I change #!/bin/sh
to #!/bin/bash
, error log changes:
web_1| /usr/src/app/entrypoint.sh: line 5: nc: command not found
Dockerfile:
FROM python:3.7-slim-buster
RUN apt-get update && apt-get -y dist-upgrade
RUN apt-get -y install build-essential libssl-dev libffi-dev libblas3 libc6 liblapack3 gcc python3-dev python3-pip cython3
RUN apt-get -y install python3-numpy python3-scipy
# set working directory
WORKDIR /usr/src/app
COPY ./requirements.txt /usr/src/app/requirements.txt
RUN pip3 install -r requirements.txt
# add entrypoint.sh
COPY ./entrypoint.sh /usr/src/app/entrypoint.sh
RUN chmod +x /usr/src/app/entrypoint.sh
# add app
COPY . /usr/src/app
# run server
CMD ["/usr/src/app/entrypoint.sh"]
entrypoint.sh
#!/bin/sh
echo "Waiting for postgres..."
while ! nc -z web-db 5432; do
sleep 0.1
done
rm -rf celery_logs/*
echo "PostgreSQL started"
python manage.py run -h 0.0.0.0
Note: this entrypoint configuration used to work with Alpine
, and now has changed to Debian
.
what am I missing?