feat(docker): add docker-compose.yml, Dockerfile

Signed-off-by: miguel456 <me@nogueira.codes>
This commit is contained in:
Miguel Nogueira 2023-08-05 02:56:54 +01:00
parent 9f6cebc1a2
commit 9dc82708dd
No known key found for this signature in database
GPG Key ID: 3C6A7E29AF26D370
3 changed files with 112 additions and 0 deletions

38
Dockerfile Normal file
View File

@ -0,0 +1,38 @@
# Use the official PHP-FPM image as the base image
FROM php:8.1-fpm
# Install system dependencies
RUN apt-get update && apt-get install -y \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libzip-dev \
unzip \
libcurl4-openssl-dev \
libonig-dev \
imagemagick \
libmagickwand-dev \
&& pecl install imagick \
&& docker-php-ext-enable imagick
# Remove xdebug later
# Install PHP extensions
RUN docker-php-ext-install gd pdo pdo_mysql zip curl mbstring xml
# Set the working directory in the container
WORKDIR /var/www/html
# Copy the Laravel application files to the container
COPY . .
# Install Composer (if you haven't installed it globally on your host machine)
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Install/update application dependencies using Composer
RUN composer update && composer install
# Expose port 9000 to connect to the PHP-FPM server
EXPOSE 9000
# Start PHP-FPM to serve the Laravel application
CMD ["php-fpm"]

58
docker-compose.yml Normal file
View File

@ -0,0 +1,58 @@
version: '3.8'
services:
athenahr_app:
image: athenahr
container_name: athenahr_app
volumes:
- ./rbrecruiter-gc:/var/www/html
ports:
- "8080:9000"
networks:
- athenahrdev_network
depends_on:
- athenahrdev_node
- mariadb
athenahrdev_node:
image: node:14
container_name: athenahr_node
volumes:
- ./rbrecruiter-gc:/usr/src/app
working_dir: /usr/src/app
networks:
- athenahrdev_network
mariadb:
image: mariadb:latest
container_name: athenahr_mariadb
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
environment:
- MYSQL_DATABASE=my_database
- MYSQL_USER=my_user
- MYSQL_PASSWORD=my_password
- MYSQL_ROOT_PASSWORD=my_root_password
volumes:
- mariadb_data:/var/lib/mysql
networks:
- athenahrdev_network
nginx:
image: nginx:latest
container_name: athenahr_nginx
volumes:
- ./rbrecruiter-gc:/var/www/html
- ./docker/nginx:/etc/nginx/conf.d
ports:
- "8989:80"
networks:
- athenahrdev_network
depends_on:
- athenahr_app
networks:
athenahrdev_network:
volumes:
mariadb_data:

View File

@ -0,0 +1,16 @@
server {
listen 80;
server_name athenahr.test;
location / {
index index.php;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass athenahr_app:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
}
}