-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Dockerfile and Caddyfile configurations
- Loading branch information
1 parent
0ef28fe
commit d608b9f
Showing
6 changed files
with
173 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,49 @@ | ||
FROM php:8.2-cli-alpine3.18 AS build | ||
|
||
RUN mkdir -p /var/www/html | ||
RUN mkdir -p /var/www/html/databasestore | ||
|
||
WORKDIR /var/www/html | ||
|
||
# Install Composer manually | ||
COPY --from=composer/composer:latest-bin /composer /usr/bin/composer | ||
|
||
RUN apk add --no-cache \ | ||
npm | ||
|
||
COPY ./ /var/www/html | ||
|
||
RUN composer install --optimize-autoloader --no-interaction --no-dev --ignore-platform-req=ext-intl | ||
|
||
FROM dunglas/frankenphp | ||
FROM unit:php8.2 | ||
|
||
RUN mkdir -p /var/www/html | ||
RUN mkdir -p /var/www/html/databasestore | ||
|
||
WORKDIR /var/www/html | ||
|
||
WORKDIR /app/public | ||
COPY --from=build --chown=unit:unit /var/www/html /var/www/html | ||
|
||
ENV TZ=Europe/Berlin | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y netcat-traditional && \ | ||
rm -rf /var/lib/apt/lists/* | ||
# Update package lists and install required dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
netcat \ | ||
libicu-dev \ | ||
libjpeg-dev \ | ||
libpng-dev \ | ||
libfreetype6-dev \ | ||
sudo \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN install-php-extensions \ | ||
pdo_mysql \ | ||
gd \ | ||
intl \ | ||
zip \ | ||
opcache | ||
# Install and enable the intl and gd extensions | ||
RUN docker-php-ext-install intl gd pdo_mysql | ||
|
||
COPY --from=build /var/www/html /app/public | ||
COPY docker/config.json /docker-entrypoint.d/config.json | ||
|
||
RUN chmod +x /app/public/docker/entrypoint.sh | ||
COPY docker/entrypoint.sh /docker-entrypoint.d/entrypoint.sh | ||
|
||
EXPOSE 80 | ||
RUN chmod +x /docker-entrypoint.d/entrypoint.sh | ||
|
||
ENTRYPOINT ["/app/public/docker/entrypoint.sh"] | ||
CMD [ "frankenphp", "run", "--config", "/app/public/docker/Caddyfile" ] | ||
EXPOSE 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,41 @@ | ||
{ | ||
# Enable FrankenPHP | ||
frankenphp | ||
# Configure when the directive must be executed | ||
order php_server before file_server | ||
# Disable tls | ||
auto_https off | ||
{$CADDY_GLOBAL_OPTIONS} | ||
|
||
frankenphp { | ||
#worker /path/to/your/worker.php | ||
{$FRANKENPHP_CONFIG} | ||
} | ||
|
||
# https://caddyserver.com/docs/caddyfile/directives#sorting-algorithm | ||
order mercure after encode | ||
order vulcain after reverse_proxy | ||
order php_server before file_server | ||
order php before file_server | ||
auto_https off | ||
servers { | ||
trusted_proxies static [private_ranges] | ||
} | ||
} | ||
|
||
{$CADDY_EXTRA_CONFIG} | ||
|
||
{$SERVER_NAME:localhost} { | ||
log { | ||
# Redact the authorization query parameter that can be set by Mercure | ||
format filter { | ||
wrap console | ||
fields { | ||
uri query { | ||
replace authorization REDACTED | ||
} | ||
} | ||
} | ||
} | ||
|
||
root * public/ | ||
encode zstd gzip | ||
|
||
{$CADDY_SERVER_EXTRA_DIRECTIVES} | ||
|
||
php_server | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"listeners": { | ||
"*:80": { | ||
"pass": "routes" | ||
} | ||
}, | ||
"routes": [ | ||
{ | ||
"match": { | ||
"uri": "!/index.php" | ||
}, | ||
"action": { | ||
"share": "/var/www/html/public$uri", | ||
"response_headers": { | ||
"Cache-Control": "max-age=60, s-maxage=120" | ||
}, | ||
"fallback": { | ||
"pass": "applications/laravel" | ||
} | ||
} | ||
} | ||
], | ||
"applications": { | ||
"laravel": { | ||
"type": "php", | ||
"root": "/var/www/html/public/", | ||
"script": "index.php" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#!/bin/bash | ||
|
||
pwd | ||
ls -al | ||
|
||
mkdir -p storage/framework/{sessions,views,cache} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
version: "3" | ||
|
||
networks: | ||
web: | ||
external: true | ||
stack: | ||
|
||
volumes: | ||
storage: | ||
database: | ||
|
||
services: | ||
backend: | ||
image: ghcr.io/chaostreff-flensburg/pretty-good-proposal/backend:latest | ||
restart: always | ||
volumes: | ||
- storage:/var/www/html/storage | ||
labels: | ||
- "traefik.enable=true" | ||
- "traefik.http.routers.api-pgp.rule=Host(`api.bewerbung.c3fl.de`)" | ||
- "traefik.http.routers.api-pgp.entrypoints=https,http" | ||
- "traefik.http.services.api-pgp.loadbalancer.server.port=80" | ||
- "traefik.http.routers.api-pgp.tls.certresolver=mytlschallenge" | ||
- "traefik.docker.network=web" | ||
working_dir: /app/public | ||
networks: | ||
- web | ||
- stack | ||
env_file: | ||
- .env | ||
logging: | ||
options: | ||
max-size: "10m" | ||
|
||
database: | ||
image: mysql:8.0 | ||
volumes: | ||
- database:/var/lib/mysql:cached | ||
networks: | ||
- stack | ||
ports: | ||
- 127.0.0.1:3306:3306 | ||
env_file: | ||
- .env | ||
command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci --sql_mode='' | ||
logging: | ||
options: | ||
max-size: "10m" | ||
max-file: "3" | ||
restart: always | ||
|
||
frontend: | ||
image: ghcr.io/chaostreff-flensburg/pretty-good-proposal/frontend:latest | ||
restart: always | ||
labels: | ||
- "traefik.enable=true" | ||
- "traefik.http.routers.frontend-pgp.rule=Host(`bewerbung.c3fl.de`)" | ||
- "traefik.http.routers.frontend-pgp.entrypoints=https,http" | ||
- "traefik.http.services.frontend-pgp.loadbalancer.server.port=80" | ||
- "traefik.http.routers.frontend-pgp.tls.certresolver=mytlschallenge" | ||
- "traefik.docker.network=web" | ||
networks: | ||
- web | ||
logging: | ||
options: | ||
max-size: "10m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters