Skip to content

Commit

Permalink
First draft
Browse files Browse the repository at this point in the history
  • Loading branch information
sstenchlak committed Nov 15, 2023
1 parent d78101d commit 656a096
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 1 deletion.
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
6 changes: 5 additions & 1 deletion app/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 6 additions & 0 deletions docker-compose-example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
config/app/*
!config/app/.gitkeep
log/*
!log/.gitkeep
temp/*
!temp/.gitkeep
Empty file.
31 changes: 31 additions & 0 deletions docker-compose-example/config/webs.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Directory /var/www/webs>
AllowOverride All
Require all granted
</Directory>

#SetEnv NETTE_DEVEL 1
SetEnv NETTE_EXTERNAL_LOCAL_CONFIG 1

<VirtualHost *:80>
ServerName online.fyziklani.cz.local
ServerAlias online.fyziklani.org.local
DocumentRoot /var/www/webs/www/fol
</VirtualHost>

<VirtualHost *:80>
ServerName fyziklani.cz.local
ServerAlias fyziklani.org.local
DocumentRoot /var/www/webs/www/fof
</VirtualHost>

<VirtualHost *:80>
ServerName dsef.cz.local
ServerAlias dsef.org.local
DocumentRoot /var/www/webs/www/dsef
</VirtualHost>

<VirtualHost *:80>
ServerName fykos.cz.local
ServerAlias fykos.org.local
DocumentRoot /var/www/webs/www/fykos
</VirtualHost>
16 changes: 16 additions & 0 deletions docker-compose-example/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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/"
Empty file.
Empty file.

0 comments on commit 656a096

Please sign in to comment.