I have been getting the below terminal errors when running:
docker-compose -f local.yml build
While following the docs here for running cookiecutter-django locally:
The output I am getting where it freezes is shown below:
=> ERROR [docs python-build-stage 3/3] RUN pip wheel --no-cache-dir --wheel-dir /usr/src/app/wh 9.0s
=> [django internal] load .dockerignore 0.0s
=> => transferring context: 211B 0.0s
=> [django internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.73kB 0.0s
=> [celerybeat internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.73kB 0.0s
=> [celerybeat internal] load .dockerignore 0.0s
=> => transferring context: 211B 0.0s
=> [celerybeat internal] load build context 0.0s
=> => transferring context: 14.61kB 0.0s
=> CACHED [celeryworker python-run-stage 1/22] WORKDIR /app 0.0s
=> CACHED [celeryworker python-run-stage 2/22] RUN apt-get update && apt-get install --no-inst 0.0s
=> CACHED [celeryworker python-run-stage 3/22] RUN groupadd --gid 1000 dev-user && useradd - 0.0s
=> CACHED [celeryworker python-run-stage 4/22] RUN apt-get update && apt-get install --no-inst 0.0s
=> [django internal] load build context 0.0s
=> => transferring context: 14.61kB 0.0s
=> CACHED [celerybeat python-build-stage 1/3] RUN apt-get update && apt-get install --no-instal 0.0s
=> CACHED [celerybeat python-build-stage 2/3] COPY ./requirements . 0.0s
=> CANCELED [celerybeat python-build-stage 3/3] RUN pip wheel --wheel-dir /usr/src/app/wheels 8.5s
=> [celeryworker internal] load .dockerignore 0.0s
=> => transferring context: 211B 0.0s
=> [celeryworker internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.73kB 0.0s
=> [flower internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.73kB 0.0s
=> [flower internal] load .dockerignore 0.0s
=> => transferring context: 211B 0.0s
=> [flower internal] load build context 0.0s
=> => transferring context: 14.61kB 0.0s
=> [celeryworker internal] load build context 0.0s
=> => transferring context: 14.61kB
Once it reaches the above state it freezes.
I have tried deleting the images via:
docker system prune -a
Rerunning but essentially the same result, after checking also I have the correct prerequisites installed in my system.
Any help with this would be great!
I have tried deleting the images via:
docker system prune -a
Rerunning but essentially the same result, after checking also I have the correct prerequisites installed in my system.
Here is the contents of my local.yml:
version: '3'
volumes:
report_writer_local_postgres_data: {}
report_writer_local_postgres_data_backups: {}
services:
django: &django
build:
context: .
dockerfile: ./compose/local/django/Dockerfile
image: report_writer_local_django
container_name: report_writer_local_django
depends_on:
- postgres
- redis
- mailhog
volumes:
- .:/app:z
env_file:
- ./.envs/.local/.django
- ./.envs/.local/.postgres
ports:
- '8000:8000'
command: /start
postgres:
build:
context: .
dockerfile: ./compose/production/postgres/Dockerfile
image: report_writer_production_postgres
container_name: report_writer_local_postgres
volumes:
- report_writer_local_postgres_data:/var/lib/postgresql/data
- report_writer_local_postgres_data_backups:/backups
env_file:
- ./.envs/.local/.postgres
docs:
image: report_writer_local_docs
container_name: report_writer_local_docs
build:
context: .
dockerfile: ./compose/local/docs/Dockerfile
env_file:
- ./.envs/.local/.django
volumes:
- ./docs:/docs:z
- ./config:/app/config:z
- ./report_writer:/app/report_writer:z
ports:
- '9000:9000'
command: /start-docs
mailhog:
image: mailhog/mailhog:v1.0.0
container_name: report_writer_local_mailhog
ports:
- '8025:8025'
redis:
image: redis:6
container_name: report_writer_local_redis
celeryworker:
<<: *django
image: report_writer_local_celeryworker
container_name: report_writer_local_celeryworker
depends_on:
- redis
- postgres
- mailhog
ports: []
command: /start-celeryworker
celerybeat:
<<: *django
image: report_writer_local_celerybeat
container_name: report_writer_local_celerybeat
depends_on:
- redis
- postgres
- mailhog
ports: []
command: /start-celerybeat
flower:
<<: *django
image: report_writer_local_flower
container_name: report_writer_local_flower
ports:
- '5555:5555'
command: /start-flower
node:
build:
context: .
dockerfile: ./compose/local/node/Dockerfile
image: report_writer_local_node
container_name: report_writer_local_node
depends_on:
- django
volumes:
- .:/app:z
# http://jdlm.info/articles/2016/03/06/lessons-building-node-app-docker.html
- /app/node_modules
command: npm run dev
ports:
- '3000:3000'
And here is the content of the Dockerfile:
# define an alias for the specific python version used in this file.
FROM python:3.11.4-slim-bullseye as python
# Python build stage
FROM python as python-build-stage
ARG BUILD_ENVIRONMENT=local
# Install apt packages
RUN apt-get update && apt-get install --no-install-recommends -y \
# dependencies for building Python packages
build-essential \
# psycopg2 dependencies
libpq-dev
# Requirements are installed here to ensure they will be cached.
COPY ./requirements .
# Create Python Dependency and Sub-Dependency Wheels.
RUN pip wheel --wheel-dir /usr/src/app/wheels \
-r ${BUILD_ENVIRONMENT}.txt
# Python 'run' stage
FROM python as python-run-stage
ARG BUILD_ENVIRONMENT=local
ARG APP_HOME=/app
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV BUILD_ENV ${BUILD_ENVIRONMENT}
WORKDIR ${APP_HOME}
# devcontainer dependencies and utils
RUN apt-get update && apt-get install --no-install-recommends -y \
sudo git bash-completion nano ssh
# Create devcontainer user and add it to sudoers
RUN groupadd --gid 1000 dev-user \
&& useradd --uid 1000 --gid dev-user --shell /bin/bash --create-home dev-user \
&& echo dev-user ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/dev-user \
&& chmod 0440 /etc/sudoers.d/dev-user
# Install required system dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
# psycopg2 dependencies
libpq-dev \
# Translations dependencies
gettext \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*
# All absolute dir copies ignore workdir instruction. All relative dir copies are wrt to the workdir instruction
# copy python dependency wheels from python-build-stage
COPY --from=python-build-stage /usr/src/app/wheels /wheels/
# use wheels to install python dependencies
RUN pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* \
&& rm -rf /wheels/
COPY ./compose/production/django/entrypoint /entrypoint
RUN sed -i 's/\r$//g' /entrypoint
RUN chmod +x /entrypoint
COPY ./compose/local/django/start /start
RUN sed -i 's/\r$//g' /start
RUN chmod +x /start
COPY ./compose/local/django/celery/worker/start /start-celeryworker
RUN sed -i 's/\r$//g' /start-celeryworker
RUN chmod +x /start-celeryworker
COPY ./compose/local/django/celery/beat/start /start-celerybeat
RUN sed -i 's/\r$//g' /start-celerybeat
RUN chmod +x /start-celerybeat
COPY ./compose/local/django/celery/flower/start /start-flower
RUN sed -i 's/\r$//g' /start-flower
RUN chmod +x /start-flower
# copy application code to WORKDIR
COPY . ${APP_HOME}
ENTRYPOINT ["/entrypoint"]
Any help with this would be great!