diff --git a/Dockerfile b/Dockerfile index ff8202d..a717265 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Use an official Python runtime as a parent image -FROM python:3.8-bullseye +FROM nikolaik/python-nodejs:python3.11-nodejs20-slim LABEL maintainer="hello@wagtail.org" # Set environment varibles @@ -7,7 +7,7 @@ ENV PYTHONUNBUFFERED 1 # Install libenchant and create the requirements folder. RUN apt-get update -y \ - && apt-get install -y libenchant-2-dev postgresql-client \ + && apt-get install -y libenchant-2-dev postgresql-client libpq-dev gcc make git \ && mkdir -p /code/requirements # Install the bakerydemo project's dependencies into the image. @@ -26,3 +26,7 @@ RUN cd /code/wagtail/ \ COPY ./libs/Willow /code/willow/ RUN cd /code/willow/ \ && pip install -e .[testing] + +# Copy the npm dependencies and install them. +COPY ./wagtail/package.json ./wagtail/package-lock.json ./ +RUN npm --prefix / install --loglevel info diff --git a/Dockerfile.frontend b/Dockerfile.frontend deleted file mode 100644 index 305c174..0000000 --- a/Dockerfile.frontend +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:18-slim -LABEL maintainer="hello@wagtail.org" - -RUN apt-get update && apt-get install rsync make -y -COPY ./wagtail/package.json ./wagtail/package-lock.json ./ - -RUN npm --prefix / install --loglevel info diff --git a/docker-compose.yml b/docker-compose.yml index 341cd11..ce1beb5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,7 +9,7 @@ services: container_name: "web" build: ./ working_dir: /code/bakerydemo - command: python manage.py runserver 0.0.0.0:8000 + command: bash -c "cd /code/wagtail && npm run start & python manage.py runserver 0.0.0.0:8000" restart: "no" volumes: - ./wagtail:/code/wagtail:delegated,rw @@ -22,7 +22,6 @@ services: PYTHONPATH: "/code/wagtail:/code/bakerydemo" depends_on: - db - - frontend db: container_name: "db" image: postgres:12.3-alpine @@ -35,15 +34,3 @@ services: restart: "no" expose: - "5432" - frontend: - container_name: "frontend" - build: - context: . - dockerfile: Dockerfile.frontend - working_dir: /code/wagtail - volumes: - - ./wagtail:/code/wagtail:delegated,rw - - node_modules:/code/wagtail/node_modules/ - command: bash -c "echo 'Copying node_modules, this may take a few minutes...' && rsync -rah --info=progress2 /node_modules /code/wagtail/ && npm run start" - restart: "no" - tty: true