Skip to content

Commit bf66018

Browse files
authored
Merge pull request #22 from fundhuesped/donde-dockerized
dockerizacion donde
2 parents 123799d + f5bebd2 commit bf66018

File tree

3 files changed

+97
-0
lines changed

3 files changed

+97
-0
lines changed

.cloud/docker/Dockerfile

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
FROM php:7.4-fpm
2+
3+
# Installing dependencies
4+
RUN apt-get update && apt-get install -y --no-install-recommends \
5+
build-essential \
6+
default-mysql-client \
7+
libpng-dev \
8+
libjpeg62-turbo-dev \
9+
libfreetype6-dev \
10+
libmagickwand-dev \
11+
libzip-dev \
12+
libonig-dev \
13+
locales \
14+
zip \
15+
jpegoptim optipng pngquant gifsicle \
16+
&& pecl install imagick
17+
18+
# Clear cache
19+
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
20+
21+
# Installing extensions
22+
RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl bcmath opcache
23+
RUN docker-php-ext-enable imagick
24+
25+
# Installing composer
26+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
27+
28+
# Changing Workdir
29+
WORKDIR /application
30+
31+
# Add user for laravel application
32+
RUN groupadd -g 1000 www
33+
RUN useradd -u 1000 -ms /bin/bash -g www www
34+
35+
# Copy existing application directory contents
36+
COPY . /application
37+
38+
# Copy existing application directory permissions
39+
COPY --chown=www:www . /application
40+
41+
# Change current user to www
42+
USER www

.cloud/nginx/nginx.conf

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
server {
2+
listen 80;
3+
index index.php index.html index.htm;
4+
root /application/public; # default Laravel's entry point for all requests
5+
6+
access_log /var/log/nginx/access.log;
7+
error_log /var/log/nginx/error.log;
8+
9+
location / {
10+
# try to serve file directly, fallback to index.php
11+
try_files $uri /index.php?$args;
12+
}
13+
14+
location ~ \.php$ {
15+
fastcgi_index index.php;
16+
fastcgi_pass app:9000; # app es el servicio de docker-compose
17+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
18+
fastcgi_param PATH_INFO $fastcgi_path_info;
19+
include fastcgi_params;
20+
}
21+
}

docker-compose.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: '3'
2+
3+
services:
4+
app:
5+
build: .cloud/docker
6+
image: donde
7+
depends_on:
8+
- mysql
9+
volumes:
10+
- ./:/application:cached
11+
12+
mysql:
13+
image: mysql:8
14+
command: --default-authentication-plugin=mysql_native_password
15+
ports:
16+
- "3306:3306"
17+
environment:
18+
- MYSQL_ROOT_PASSWORD=secret
19+
- MYSQL_DATABASE=donde
20+
volumes:
21+
- db-data:/var/lib/mysql:cached
22+
23+
nginx:
24+
image: nginx:alpine
25+
ports:
26+
- "80:80"
27+
volumes:
28+
- .cloud/nginx/nginx.conf:/etc/nginx/conf.d/default.conf:cached
29+
- ./:/application:cached
30+
depends_on:
31+
- app
32+
33+
volumes:
34+
db-data:

0 commit comments

Comments
 (0)