diff --git a/.github/workflows/deploy-image.yml b/.github/workflows/deploy-image.yml
new file mode 100644
index 00000000..9c6829c2
--- /dev/null
+++ b/.github/workflows/deploy-image.yml
@@ -0,0 +1,34 @@
+name: Create and publish a Docker image
+on: push
+
+env:
+ REGISTRY: ghcr.io
+ IMAGE_NAME: ${{ github.repository }}
+
+jobs:
+ build-and-push-image:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ packages: write
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ - name: Log in to the Container registry
+ uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
+ with:
+ registry: ${{ env.REGISTRY }}
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+ - name: Extract metadata (tags, labels) for Docker
+ id: meta
+ uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
+ with:
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+ - name: Build and push Docker image
+ uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
+ with:
+ context: .
+ push: true
+ tags: ${{ steps.meta.outputs.tags }}
+ labels: ${{ steps.meta.outputs.labels }}
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 00000000..590dcb0c
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,33 @@
+# Compile Javascript and CSS
+FROM node:latest AS node-builder
+WORKDIR /usr/src/webs
+COPY . .
+RUN npm install && npm run build
+
+# Install PHP dependencies and init translations
+FROM composer as composer-builder
+WORKDIR /usr/src/webs
+COPY --from=node-builder /usr/src/webs /usr/src/webs
+RUN composer install --no-dev --no-interaction --no-progress --optimize-autoloader --ignore-platform-reqs
+
+# Prepare files for the final image
+RUN mkdir /usr/src/final
+RUN cp -r /usr/src/webs/app /usr/src/webs/www /usr/src/webs/vendor /usr/src/final/
+
+# Final image
+FROM php:8.2-apache
+RUN apt-get update && apt install -y \
+ gettext \
+ locales \
+&& docker-php-ext-configure gettext \
+&& docker-php-ext-install \
+ gettext \
+&& a2enmod rewrite \
+&& sed -i -e 's/# cs_CZ.UTF-8/cs_CZ.UTF-8/' /etc/locale.gen \
+&& sed -i -e 's/# en_US.UTF-8/en_US.UTF-8/' /etc/locale.gen \
+&& dpkg-reconfigure --frontend=noninteractive locales
+
+USER www-data
+WORKDIR /var/www/webs
+COPY --chown=www-data --from=composer-builder /usr/src/final /var/www/webs/
+RUN ./app/i18n/compile.sh
diff --git a/app/Bootstrap.php b/app/Bootstrap.php
index f2b8b26b..27aa3844 100644
--- a/app/Bootstrap.php
+++ b/app/Bootstrap.php
@@ -25,7 +25,11 @@ private static function boot(string $site): Configurator
->register();
$configurator->addConfig(__DIR__ . '/config/config.' . $site . '.neon');
- $configurator->addConfig(__DIR__ . '/config/config.' . $site . '.local.neon');
+ if (getenv('NETTE_EXTERNAL_LOCAL_CONFIG') === '1') {
+ $configurator->addConfig(__DIR__ . '/config/local/config.' . $site . '.local.neon');
+ } else {
+ $configurator->addConfig(__DIR__ . '/config/config.' . $site . '.local.neon');
+ }
return $configurator;
}
diff --git a/docker-compose-example/.gitignore b/docker-compose-example/.gitignore
new file mode 100644
index 00000000..9e85ef3a
--- /dev/null
+++ b/docker-compose-example/.gitignore
@@ -0,0 +1,6 @@
+config/app/*
+!config/app/.gitkeep
+log/*
+!log/.gitkeep
+temp/*
+!temp/.gitkeep
\ No newline at end of file
diff --git a/docker-compose-example/config/app/.gitkeep b/docker-compose-example/config/app/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/docker-compose-example/config/webs.conf b/docker-compose-example/config/webs.conf
new file mode 100644
index 00000000..71abbe9d
--- /dev/null
+++ b/docker-compose-example/config/webs.conf
@@ -0,0 +1,31 @@
+
+ AllowOverride All
+ Require all granted
+
+
+#SetEnv NETTE_DEVEL 1
+SetEnv NETTE_EXTERNAL_LOCAL_CONFIG 1
+
+
+ ServerName online.fyziklani.cz.local
+ ServerAlias online.fyziklani.org.local
+ DocumentRoot /var/www/webs/www/fol
+
+
+
+ ServerName fyziklani.cz.local
+ ServerAlias fyziklani.org.local
+ DocumentRoot /var/www/webs/www/fof
+
+
+
+ ServerName dsef.cz.local
+ ServerAlias dsef.org.local
+ DocumentRoot /var/www/webs/www/dsef
+
+
+
+ ServerName fykos.cz.local
+ ServerAlias fykos.org.local
+ DocumentRoot /var/www/webs/www/fykos
+
\ No newline at end of file
diff --git a/docker-compose-example/docker-compose.yml b/docker-compose-example/docker-compose.yml
new file mode 100644
index 00000000..5207375a
--- /dev/null
+++ b/docker-compose-example/docker-compose.yml
@@ -0,0 +1,16 @@
+version: '3.5'
+services:
+ app:
+ build: ..
+ ports:
+ - "8080:80"
+ user: "1000:1000"
+ volumes:
+ # Cache directory
+ - "./temp:/var/www/webs/temp/"
+ # Error logs
+ - "./log:/var/www/webs/log/"
+ # Apache configuration
+ - "./config/webs.conf:/etc/apache2/sites-enabled/000-default.conf"
+ # App configuration
+ - "./config/app:/var/www/webs/app/config/local/"
diff --git a/docker-compose-example/log/.gitkeep b/docker-compose-example/log/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/docker-compose-example/temp/.gitkeep b/docker-compose-example/temp/.gitkeep
new file mode 100644
index 00000000..e69de29b