-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Docker configuration for running in container
- Loading branch information
Showing
2 changed files
with
104 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,70 @@ | ||
FROM php:7.4-apache | ||
|
||
WORKDIR /var/www/html | ||
|
||
# Hand over all of /var/www to www-data | ||
RUN chown www-data:www-data /var/www | ||
|
||
# enable error loggging | ||
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" | ||
|
||
# Install system dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
build-essential \ | ||
git \ | ||
curl \ | ||
libpng-dev \ | ||
libjpeg-dev \ | ||
libfreetype6-dev \ | ||
libjpeg62-turbo-dev \ | ||
libmcrypt-dev \ | ||
libgd-dev \ | ||
jpegoptim optipng pngquant gifsicle \ | ||
libonig-dev \ | ||
libxml2-dev \ | ||
zip \ | ||
unzip && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Install PHP extensions | ||
RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg | ||
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd | ||
|
||
# Enable .htaccess files | ||
RUN sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf | ||
|
||
# Set /public as served directory | ||
ENV APACHE_DOCUMENT_ROOT /var/www/html/xelif/public | ||
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf | ||
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf | ||
|
||
# Enable rewrite module | ||
RUN a2enmod rewrite | ||
|
||
# Increase PHP memory limit | ||
RUN echo 'memory_limit = 1G' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini; | ||
|
||
# Install PHP composer | ||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | ||
|
||
# Leave superuser mode, switching to www-data user for dependency installation | ||
USER www-data | ||
|
||
# just copy everything over | ||
WORKDIR /var/www/html/xelif | ||
COPY --chown=www-data:www-data . . | ||
|
||
RUN composer install \ | ||
--no-cache \ | ||
--no-interaction \ | ||
--no-plugins \ | ||
--no-scripts \ | ||
--no-dev \ | ||
--prefer-dist \ | ||
--optimize-autoloader \ | ||
--apcu-autoloader | ||
|
||
RUN composer dump-autoload | ||
|
||
RUN php artisan optimize:clear | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
version: '3.8' | ||
|
||
services: | ||
xelif: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
# Make sure database is started first | ||
depends_on: | ||
- xelif-db | ||
# For debugging only | ||
ports: | ||
- 80:80 | ||
# For communication with database | ||
networks: | ||
- internal | ||
container_name: xelif | ||
volumes: | ||
- "/srv/felix/uploads:/var/www/html/xelif/storage/app/public/uploads" | ||
env_file: | ||
- ".env" | ||
|
||
xelif-db: | ||
image: mysql | ||
restart: always | ||
container_name: xelif-db | ||
volumes: | ||
- "/opt/mysql:/var/lib/mysql" | ||
- "/opt/mysqld.conf:/etc/mysql/conf.d/mysqld.conf" | ||
networks: | ||
- internal | ||
|
||
networks: | ||
internal: |