fix: docker support

This commit is contained in:
Maël Gangloff 2024-08-11 20:24:04 +02:00
parent 83aa283b3d
commit 2def3bbc8e
No known key found for this signature in database
GPG Key ID: 11FDC81C24A7F629
2 changed files with 34 additions and 28 deletions

View File

@ -1,4 +1,4 @@
#syntax=docker/dockerfile:1.4 # syntax=docker/dockerfile:1.4
# Versions # Versions
FROM dunglas/frankenphp:1-php8.3 AS frankenphp_upstream FROM dunglas/frankenphp:1-php8.3 AS frankenphp_upstream
@ -7,7 +7,6 @@ FROM dunglas/frankenphp:1-php8.3 AS frankenphp_upstream
# https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage # https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage
# https://docs.docker.com/compose/compose-file/#target # https://docs.docker.com/compose/compose-file/#target
# Base FrankenPHP image # Base FrankenPHP image
FROM frankenphp_upstream AS frankenphp_base FROM frankenphp_upstream AS frankenphp_base
@ -18,24 +17,27 @@ VOLUME /app/var/
# persistent / runtime deps # persistent / runtime deps
# hadolint ignore=DL3008 # hadolint ignore=DL3008
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
acl \ acl \
file \ file \
gettext \ gettext \
git \ git \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN set -eux; \ RUN set -eux; \
install-php-extensions \ install-php-extensions \
@composer \ @composer \
apcu \ apcu \
intl \ intl \
opcache \ opcache \
zip \ zip
;
RUN set -eux; \
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -; \
apt-get install -y nodejs; \
npm install -g yarn
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser # https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
ENV COMPOSER_ALLOW_SUPERUSER=1 ENV COMPOSER_ALLOW_SUPERUSER=1
ENV PHP_INI_SCAN_DIR=":$PHP_INI_DIR/app.conf.d" ENV PHP_INI_SCAN_DIR=":$PHP_INI_DIR/app.conf.d"
###> recipes ### ###> recipes ###
@ -49,7 +51,6 @@ COPY --link --chmod=755 frankenphp/docker-entrypoint.sh /usr/local/bin/docker-en
COPY --link frankenphp/Caddyfile /etc/caddy/Caddyfile COPY --link frankenphp/Caddyfile /etc/caddy/Caddyfile
ENTRYPOINT ["docker-entrypoint"] ENTRYPOINT ["docker-entrypoint"]
HEALTHCHECK --start-period=60s CMD curl -f http://localhost:2019/metrics || exit 1 HEALTHCHECK --start-period=60s CMD curl -f http://localhost:2019/metrics || exit 1
CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ] CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ]
@ -61,9 +62,8 @@ ENV APP_ENV=dev XDEBUG_MODE=off
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
RUN set -eux; \ RUN set -eux; \
install-php-extensions \ install-php-extensions \
xdebug \ xdebug
;
COPY --link frankenphp/conf.d/20-app.dev.ini $PHP_INI_DIR/app.conf.d/ COPY --link frankenphp/conf.d/20-app.dev.ini $PHP_INI_DIR/app.conf.d/
@ -83,15 +83,21 @@ COPY --link frankenphp/worker.Caddyfile /etc/caddy/worker.Caddyfile
# prevent the reinstallation of vendors at every changes in the source code # prevent the reinstallation of vendors at every changes in the source code
COPY --link composer.* symfony.* ./ COPY --link composer.* symfony.* ./
RUN set -eux; \ RUN set -eux; \
composer install --no-cache --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress composer install --no-cache --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress
# copy sources # copy sources
COPY --link . ./ COPY --link . ./
RUN rm -Rf frankenphp/ RUN rm -Rf frankenphp/
RUN set -eux; \ RUN set -eux; \
mkdir -p var/cache var/log; \ mkdir -p var/cache var/log; \
composer dump-autoload --classmap-authoritative --no-dev; \ composer dump-autoload --classmap-authoritative --no-dev; \
composer dump-env prod; \ composer dump-env prod; \
composer run-script --no-dev post-install-cmd; \ composer run-script --no-dev post-install-cmd; \
chmod +x bin/console; sync; \ chmod +x bin/console; \
sync
RUN php bin/console assets:install
RUN yarn install
RUN yarn run build
RUN yarn run ttag:po2json

View File

@ -12,7 +12,7 @@
<meta property="og:type" content="website"/> <meta property="og:type" content="website"/>
<meta property="og:title" content="Domain Watchdog"/> <meta property="og:title" content="Domain Watchdog"/>
<meta property="og:image" content="{{ asset('images/banner.png') }}"> <meta property="og:image" content="/images/banner.png">
<meta property="og:description" <meta property="og:description"
content="A standalone app that collects open access information about domain names, helping users track the history and changes associated with domain names"/> content="A standalone app that collects open access information about domain names, helping users track the history and changes associated with domain names"/>
<meta property="og:site_name" content="Domain Watchdog"/> <meta property="og:site_name" content="Domain Watchdog"/>
@ -21,11 +21,11 @@
<meta property="twitter:title" content="Domain Watchdog"/> <meta property="twitter:title" content="Domain Watchdog"/>
<meta property="twitter:description" <meta property="twitter:description"
content="A standalone app that collects open access information about domain names, helping users track the history and changes associated with domain names"/> content="A standalone app that collects open access information about domain names, helping users track the history and changes associated with domain names"/>
<meta property="twitter:image" content="{{ asset('images/banner.png') }}"/> <meta property="twitter:image" content="/images/banner.png"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="manifest" href="{{ asset('manifest.json') }}"/> <link rel="manifest" href="/manifest.json"/>
<title>Domain Watchdog</title> <title>Domain Watchdog</title>
{{ encore_entry_link_tags('app') }} {{ encore_entry_link_tags('app') }}
</head> </head>