From c1ba9820b65f351d5600c27b6fcd84e02031a478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Guillot?= Date: Wed, 19 Jun 2024 18:04:30 +0200 Subject: [PATCH] Updated - docker env --- Dockerfile | 32 ++++++++++---------------------- Makefile | 9 ++++++--- compose.override.yaml | 11 +++++++++++ compose.yaml | 20 +++++++++----------- frankenphp/conf.d/app.ini | 1 - frankenphp/docker-entrypoint.sh | 2 +- 6 files changed, 37 insertions(+), 38 deletions(-) diff --git a/Dockerfile b/Dockerfile index ac8b458..5afb41a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ #syntax=docker/dockerfile:1.4 # Versions -FROM dunglas/frankenphp:1-alpine AS frankenphp_upstream +FROM dunglas/frankenphp:1-php8.3 AS frankenphp_upstream # The different stages of this Dockerfile are meant to be built into separate images # https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage @@ -13,28 +13,16 @@ FROM frankenphp_upstream AS frankenphp_base WORKDIR /app -# persistent / runtime deps -# hadolint ignore=DL3018 -RUN apk add --no-cache \ - acl \ - file \ - gettext \ - git \ - ; +VOLUME /app/var/ -# Install Node.js and npm -ENV CHROME_BIN="/usr/bin/chromium-browser" \ - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true" -RUN set -x \ - && apk update \ - && apk upgrade \ - && apk add --no-cache \ - nodejs \ - npm \ - udev \ - ttf-freefont \ - chromium \ - && npm install puppeteer@1.10.0 +# persistent / runtime deps +# hadolint ignore=DL3008 +RUN apt-get update && apt-get install -y --no-install-recommends \ + acl \ + file \ + gettext \ + git \ + && rm -rf /var/lib/apt/lists/* RUN set -eux; \ install-php-extensions \ diff --git a/Makefile b/Makefile index 2524772..9cb71a6 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,9 @@ DOCKER_COMP_EXEC:=$(DOCKER_COMP) exec # Docker containers PHP_CONT = $(DOCKER_COMP_EXEC) php +NODE_CONT = $(DOCKER_COMP_EXEC) node + + # Executables PHP = $(PHP_CONT) php @@ -140,10 +143,10 @@ consume: ## Consume messages ## —— Webpack Encore ————————————————————————————————————————————————————————————— npm-install: ## Install npm dependencies - @$(DOCKER_COMP) exec php npm install + @$(DOCKER_COMP) exec node npm install npm-run: ## Run the dev server - @$(DOCKER_COMP) exec php npm run dev + @$(DOCKER_COMP) exec node npm run dev npm-watch: ## Watch for changes - @$(DOCKER_COMP) exec php npm run watch + @$(DOCKER_COMP) exec node npm run watch diff --git a/compose.override.yaml b/compose.override.yaml index 524e3c9..5725f93 100644 --- a/compose.override.yaml +++ b/compose.override.yaml @@ -19,6 +19,17 @@ services: # Ensure that host.docker.internal is correctly defined on Linux - host.docker.internal:host-gateway tty: true + + node: + image: node:lts-alpine + tty: true + working_dir: /app + depends_on: + - php + volumes: + - ./:/app + environment: + NODE_ENV: development ###> doctrine/doctrine-bundle ### database: diff --git a/compose.yaml b/compose.yaml index b190bdf..a5c6403 100644 --- a/compose.yaml +++ b/compose.yaml @@ -7,12 +7,12 @@ services: MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!} MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!} TRUSTED_PROXIES: ${TRUSTED_PROXIES:-127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16} - TRUSTED_HOSTS: ^${SERVER_NAME:-example\.com|localhost}|php$$ + TRUSTED_HOSTS: ${TRUSTED_HOSTS:-^${SERVER_NAME:-example\.com|localhost}|php$$} # Run "composer require symfony/orm-pack" to install and configure Doctrine ORM DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@database:5432/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-15}&charset=${POSTGRES_CHARSET:-utf8} # Run "composer require symfony/mercure-bundle" to install and configure the Mercure integration MERCURE_URL: ${CADDY_MERCURE_URL:-http://php/.well-known/mercure} - MERCURE_PUBLIC_URL: https://${SERVER_NAME:-localhost}/.well-known/mercure + MERCURE_PUBLIC_URL: ${CADDY_MERCURE_PUBLIC_URL:-https://${SERVER_NAME:-localhost}/.well-known/mercure} MERCURE_JWT_SECRET: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!} # The two next lines can be removed after initial installation SYMFONY_VERSION: ${SYMFONY_VERSION:-} @@ -20,8 +20,6 @@ services: volumes: - caddy_data:/data - caddy_config:/config - networks: - - mangarr_network ports: # HTTP - target: 80 @@ -40,8 +38,8 @@ services: ###> doctrine/doctrine-bundle ### database: - hostname: database - container_name: database +# hostname: database +# container_name: database image: postgres:${POSTGRES_VERSION:-16}-alpine environment: POSTGRES_DB: ${POSTGRES_DB:-app} @@ -50,8 +48,8 @@ services: POSTGRES_USER: ${POSTGRES_USER:-app} volumes: - database_data:/var/lib/postgresql/data:rw - networks: - - mangarr_network +# networks: +# - mangarr_network ports: - '5432:5432' # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data! @@ -100,6 +98,6 @@ volumes: mercure_config: ###< symfony/mercure-bundle ### ###< doctrine/doctrine-bundle ### -networks: - mangarr_network: - external: true +#networks: +# mangarr_network: +# external: true diff --git a/frankenphp/conf.d/app.ini b/frankenphp/conf.d/app.ini index a99c9b8..044c070 100644 --- a/frankenphp/conf.d/app.ini +++ b/frankenphp/conf.d/app.ini @@ -1,4 +1,3 @@ -variables_order = EGPCS expose_php = 0 date.timezone = UTC apc.enable_cli = 1 diff --git a/frankenphp/docker-entrypoint.sh b/frankenphp/docker-entrypoint.sh index bdddc3a..9823560 100755 --- a/frankenphp/docker-entrypoint.sh +++ b/frankenphp/docker-entrypoint.sh @@ -49,7 +49,7 @@ if [ "$1" = 'frankenphp' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then fi if [ "$( find ./migrations -iname '*.php' -print -quit )" ]; then - php bin/console doctrine:migrations:migrate --no-interaction + php bin/console doctrine:migrations:migrate --no-interaction --all-or-nothing fi fi