Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Adi Mihaila committed Sep 10, 2020
0 parents commit 8d322ac
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea/
!app
app/*
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
install:
docker-compose exec php-fpm composer create-project symfony/skeleton .

up:
docker-compose up -d

build:
docker-compose build
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Symfony Docker

A [Docker](https://www.docker.com/) based installer for the [Symfony](https://symfony.com) web framework.

## Getting Started
````
make build
make up
````

## Installation
````
make install
````

## Usage
````
Open `http://127.0.0.1` in your favorite web browser
````

## Debugging
````
docker-compose logs -f php-fpm
````
Empty file added app/.gitkeep
Empty file.
23 changes: 23 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: '3.6'
services:
nginx:
image: nginx:stable-alpine
volumes:
- ./app:/var/www/html
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
ports:
- 80:80

php-fpm:
user: "${DOCKER_USER_ID}:${DOCKER_GROUP_ID}"
build:
context: .
dockerfile: ./docker/php-fpm/Dockerfile
volumes:
- ./app:/var/www/html
# - ./app/vendor:/var/www/html/vendor:delegated

networks:
default:
driver_opts:
com.docker.network.driver.mtu: 1450
28 changes: 28 additions & 0 deletions docker/nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
server {
listen 80;

root /var/www/html/public;
client_max_body_size 10m;
location / {
# try to serve file directly, fallback to index.php
try_files $uri /index.php$is_args$args;
}

location ~ ^/index\.php(/|$) {
fastcgi_pass php-fpm:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
}

# return 404 for all other php files not matching the front controller
# this prevents access to other php files you don't want to be accessible.
location ~ \.php$ {
return 404;
}

access_log /dev/stdout;
error_log stderr;
}
21 changes: 21 additions & 0 deletions docker/php-fpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM php:7.4-fpm-alpine

MAINTAINER [email protected]

USER :33

RUN apk add --virtual build-dependencies build-base libzip-dev openssl-dev autoconf

RUN set -uex; \
umask 0002; \
curl --silent --show-error https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer \
&& chmod o+x /usr/local/bin/composer

ENV COMPOSER_HOME=/tmp/composer

WORKDIR /var/www/html

COPY . .

CMD ["php-fpm", "-F"]

0 comments on commit 8d322ac

Please sign in to comment.