- docker env
This commit is contained in:
Jérémy Guillot
2024-06-19 18:04:30 +02:00
parent f7bb7b9148
commit c1ba9820b6
6 changed files with 37 additions and 38 deletions

View File

@@ -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
VOLUME /app/var/
# persistent / runtime deps
# hadolint ignore=DL3018
RUN apk add --no-cache \
# hadolint ignore=DL3008
RUN apt-get update && apt-get install -y --no-install-recommends \
acl \
file \
gettext \
git \
;
# 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
&& rm -rf /var/lib/apt/lists/*
RUN set -eux; \
install-php-extensions \

View File

@@ -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

View File

@@ -20,6 +20,17 @@ services:
- 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:
ports:

View File

@@ -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

View File

@@ -1,4 +1,3 @@
variables_order = EGPCS
expose_php = 0
date.timezone = UTC
apc.enable_cli = 1

View File

@@ -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