Created
February 24, 2021 17:23
-
-
Save lucasemanuel/047c6c8698800e5742fb67947c8a0905 to your computer and use it in GitHub Desktop.
Docker Laravel
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
postgres |
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
server { | |
listen 80; | |
index index.php index.html; | |
error_log /var/log/nginx/error.log; | |
access_log /var/log/nginx/access.log; | |
root /var/www/public; | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass app:9000; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param PATH_INFO $fastcgi_path_info; | |
} | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
gzip_static on; | |
} | |
} |
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
version: "3.7" | |
services: | |
app: | |
build: | |
args: | |
user: conark | |
context: ./ | |
dockerfile: Dockerfile | |
container_name: conarket-api | |
restart: always | |
working_dir: /var/www/ | |
volumes: | |
- ./:/var/www | |
networks: | |
- conarket | |
db: | |
image: postgres:12 | |
container_name: conarket-db | |
restart: always | |
environment: | |
POSTGRES_DB: ${DB_DATABASE} | |
POSTGRES_PASSWORD: ${DB_PASSWORD} | |
POSTGRES_USER: ${DB_USERNAME} | |
volumes: | |
- ./docker-compose/postgres:/var/lib/postgresql/data | |
networks: | |
- conarket | |
nginx: | |
image: nginx:alpine | |
container_name: conarket-nginx | |
restart: always | |
ports: | |
- 8000:80 | |
volumes: | |
- ./:/var/www | |
- ./docker-compose/nginx:/etc/nginx/conf.d/ | |
networks: | |
- conarket | |
networks: | |
conarket: | |
driver: bridge |
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
FROM php:7.3-fpm | |
ARG user | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
git \ | |
curl \ | |
libpng-dev \ | |
libonig-dev \ | |
libxml2-dev \ | |
zip \ | |
unzip \ | |
sqlite3 \ | |
libpq-dev | |
# Clear cache | |
RUN apt-get clean && rm -rf /var/lib/apt/lists/* | |
# Install PHP extensions | |
RUN docker-php-ext-install pdo_pgsql mbstring exif pcntl bcmath gd | |
# Get latest Composer | |
COPY --from=composer:2.0.8 /usr/bin/composer /usr/bin/compose | |
RUN useradd -G www-data,root -d /home/$user $user | |
RUN mkdir -p /home/$user/.composer && \ | |
chown -R $user:$user /home/$user | |
# Set working directory | |
WORKDIR /var/www | |
USER $user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment