-
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.
- Loading branch information
0 parents
commit c3a836f
Showing
18 changed files
with
500 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"dockerComposeFile": [ | ||
"./../docker-compose.yml", | ||
"./../docker-compose.dev.yml" | ||
], | ||
"service": "php", | ||
"workspaceFolder": "/var/www/html", | ||
"forwardPorts": ["caddy:80", "db:3306"], | ||
"updateContentCommand": { | ||
"composer install": "if [ -f composer.json ]; then composer install; fi;", | ||
"yarn install": "if [ -f package.json ]; then yarn install --no-progress; fi;" | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"files.exclude": { | ||
".devcontainer/": true, | ||
".docker/": true, | ||
"node_modules/": true, | ||
"var/": true, | ||
"vendor/": true, | ||
".dockerignore": true, | ||
"docker-compose*": true, | ||
"Dockerfile": true | ||
} | ||
} | ||
} | ||
} | ||
} |
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,16 @@ | ||
{ | ||
{$CADDY_ADMIN_OPTION} | ||
{$CADDY_DEBUG_OPTION} | ||
} | ||
|
||
{$SERVER_NAME} | ||
|
||
route { | ||
root * /srv/public | ||
vulcain | ||
php_fastcgi unix//run/php/php-fpm.sock { | ||
root /var/www/html/public | ||
} | ||
encode zstd gzip | ||
file_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,6 @@ | ||
apc.enable_cli = 1 | ||
opcache.interned_strings_buffer = 16 | ||
opcache.max_accelerated_files = 20000 | ||
opcache.memory_consumption = 256 | ||
realpath_cache_size = 4096K | ||
realpath_cache_ttl = 600 |
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 @@ | ||
expose_php = Off |
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,5 @@ | ||
[global] | ||
daemonize = no | ||
|
||
[www] | ||
listen = /run/php/php-fpm.sock |
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,13 @@ | ||
**/.gitignore | ||
*.md | ||
.devcontainer/ | ||
.git/ | ||
.idea/ | ||
.vscode/ | ||
node_modules/ | ||
var/ | ||
vendor/ | ||
.dockerignore | ||
.gitignore | ||
docker-compose.* | ||
Dockerfile |
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,23 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- LICENSE | ||
- README.md | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: marvinpinto/action-automatic-releases@latest | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
automatic_release_tag: latest | ||
prerelease: true | ||
title: "Development Build" | ||
files: | | ||
LICENSE | ||
Dockerfile |
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,5 @@ | ||
/.idea/ | ||
/.vscode/ | ||
/node_modules/ | ||
/var/ | ||
/vendor/ |
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,151 @@ | ||
# Build args | ||
ARG CADDY_VERSION=2 | ||
ARG PHP_VERSION=8.2 | ||
ARG NODE_VERSION=lts | ||
ARG COMPOSER_VERSION=latest | ||
|
||
ARG TIMEZONE=UTC | ||
|
||
############################################################################### | ||
### [STAGE] caddy_builder | ||
############################################################################### | ||
FROM caddy:${CADDY_VERSION}-builder-alpine AS caddy_builder | ||
|
||
RUN xcaddy build \ | ||
--with github.com/dunglas/vulcain \ | ||
--with github.com/dunglas/vulcain/caddy | ||
|
||
############################################################################### | ||
# [STAGE] node_builder | ||
############################################################################### | ||
FROM node:${NODE_VERSION}-alpine as node_builder | ||
WORKDIR /app | ||
|
||
COPY package.json[n] package-lock.jso[n] yarn.loc[k] webpack.config.j[s] .npmr[c] .yarnr[c] ./ | ||
|
||
# OS configuration | ||
RUN mkdir -p public/build; \ | ||
# Node dependencies installation | ||
if [ -f package.json ]; then \ | ||
if [ -f yarn.lock ]; then \ | ||
yarn install --no-progress; \ | ||
else \ | ||
npm install --no-progress; \ | ||
fi; \ | ||
fi; | ||
|
||
COPY assets/ assets/ | ||
# Node.js dependencies building | ||
RUN if [ -f node_modules/.bin/encore ]; then \ | ||
mkdir -p public/build; \ | ||
node_modules/.bin/encore production; \ | ||
fi; | ||
|
||
############################################################################### | ||
### [STAGE] composer_builder | ||
############################################################################### | ||
FROM composer:${COMPOSER_VERSION} as composer_builder | ||
|
||
############################################################################### | ||
# [STAGE] php_builder | ||
############################################################################### | ||
FROM php:${PHP_VERSION}-fpm-bullseye as php_builder | ||
|
||
ARG TIMEZONE | ||
|
||
ENV COMPOSER_ALLOW_SUPERUSER=1 | ||
ENV COMPOSER_MEMORY_LIMIT=-1 | ||
|
||
# OS packages installation | ||
RUN apt-get -yqq update && apt-get -yqq install unzip; \ | ||
# OS configuration | ||
mkdir -p /run/php; \ | ||
# PHP configuration | ||
echo "date.timezone = ${TIMEZONE}" >> ${PHP_INI_DIR}/conf.d/timezone.ini; \ | ||
# Cleanup | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=mlocati/php-extension-installer:latest /usr/bin/install-php-extensions /usr/local/bin | ||
RUN install-php-extensions apcu gd intl opcache pdo_mysql xsl zip | ||
|
||
COPY --from=composer_builder /usr/bin/composer /usr/local/bin | ||
|
||
############################################################################### | ||
# [STAGE] php_prod | ||
############################################################################### | ||
FROM php_builder AS php_prod | ||
|
||
# PHP configuration | ||
RUN cp ${PHP_INI_DIR}/php.ini-production ${PHP_INI_DIR}/php.ini; \ | ||
if [ -f config/preload.php ]; then \ | ||
echo "opcache.preload_user = root" >> ${PHP_INI_DIR}/conf.d/preload.ini; \ | ||
echo "opcache.preload = /var/www/html/config/preload.php" >> ${PHP_INI_DIR}/conf.d/preload.ini; \ | ||
fi | ||
|
||
COPY .docker/php/conf.d/app.ini ${PHP_INI_DIR}/conf.d/zz-app.ini | ||
COPY .docker/php/conf.d/app.prod.ini ${PHP_INI_DIR}/conf.d/zz-app.prod.ini | ||
COPY .docker/php/php-fpm.d/zz-docker.conf /usr/local/etc/php-fpm.d/zz-docker.conf | ||
|
||
COPY composer.* symfony.* ./ | ||
|
||
# Composer dependecies installation and autoload optimizations | ||
RUN if [ -f composer.json ]; then \ | ||
composer install --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress; \ | ||
composer dump-autoload --classmap-authoritative --no-dev; \ | ||
fi | ||
|
||
COPY . . | ||
|
||
# Composer dump-env and post-install-cmd | ||
RUN if [ -f composer.json ]; then \ | ||
composer dump-env prod; \ | ||
composer run-script --no-dev post-install-cmd; \ | ||
fi; \ | ||
# Cleanup | ||
rm -rf .docker/; \ | ||
rm -f /usr/bin/install-php-extensions; \ | ||
composer clear-cache | ||
|
||
############################################################################### | ||
# [STAGE] php_dev | ||
############################################################################### | ||
FROM php_builder AS php_dev | ||
|
||
# OS packages installation | ||
RUN apt-get update && apt-get install -y git openssh-client; \ | ||
# PHP configuration | ||
cp ${PHP_INI_DIR}/php.ini-development ${PHP_INI_DIR}/php.ini; \ | ||
# PHP extension installation | ||
install-php-extensions xdebug; \ | ||
# Node.js installation | ||
curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash -; \ | ||
apt-get install -y nodejs; \ | ||
npm update -g npm; \ | ||
npm install -g yarn; \ | ||
# Cleanup | ||
rm -rf /root/.npm; \ | ||
rm -f .env.local.php | ||
|
||
############################################################################### | ||
# [STAGE] caddy_base | ||
############################################################################### | ||
FROM caddy:${CADDY_VERSION}-alpine as caddy_base | ||
|
||
# OS packages installation | ||
RUN apk add --no-cache tzdata; | ||
|
||
COPY --from=caddy_builder /usr/bin/caddy /usr/bin/caddy | ||
COPY .docker/caddy/Caddyfile /etc/caddy/Caddyfile | ||
|
||
############################################################################### | ||
# [STAGE] caddy_dev | ||
############################################################################### | ||
FROM caddy_base as caddy_dev | ||
|
||
############################################################################### | ||
# [STAGE] caddy_prod | ||
############################################################################### | ||
FROM caddy_base as caddy_prod | ||
|
||
COPY public/ public/ | ||
COPY --from=node_builder /app/public/build public/ |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Marco Polichetti | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Oops, something went wrong.