Just type "docker-compose up" to install a Flex project (major refactoring)
This commit is contained in:
parent
3b0893ce1c
commit
6d5bf66804
@ -1,8 +1,9 @@
|
|||||||
**/*.log
|
**/*.log
|
||||||
**/*.md
|
|
||||||
**/._*
|
**/._*
|
||||||
**/.DS_Store
|
**/.DS_Store
|
||||||
**/.gitignore
|
**/.gitignore
|
||||||
|
**/.gitattributes
|
||||||
**/Thumbs.db
|
**/Thumbs.db
|
||||||
.dockerignore
|
.dockerignore
|
||||||
Dockerfile
|
Dockerfile
|
||||||
|
docker-compose.yml
|
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1,3 +1,2 @@
|
|||||||
* text=auto
|
* text=auto
|
||||||
*.sh text eol=lf
|
*.sh text eol=lf
|
||||||
docker/apache/start_safe_perms text eol=lf
|
|
||||||
|
30
Dockerfile
30
Dockerfile
@ -15,7 +15,6 @@ RUN set -xe \
|
|||||||
zlib-dev \
|
zlib-dev \
|
||||||
&& docker-php-ext-install \
|
&& docker-php-ext-install \
|
||||||
intl \
|
intl \
|
||||||
pdo_mysql \
|
|
||||||
zip \
|
zip \
|
||||||
&& pecl install \
|
&& pecl install \
|
||||||
apcu-${APCU_VERSION} \
|
apcu-${APCU_VERSION} \
|
||||||
@ -23,16 +22,17 @@ RUN set -xe \
|
|||||||
&& docker-php-ext-enable --ini-name 05-opcache.ini opcache \
|
&& docker-php-ext-enable --ini-name 05-opcache.ini opcache \
|
||||||
&& apk del .build-deps
|
&& apk del .build-deps
|
||||||
|
|
||||||
|
###> recipes ###
|
||||||
|
###< recipes ###
|
||||||
|
|
||||||
COPY docker/app/php.ini /usr/local/etc/php/php.ini
|
COPY docker/app/php.ini /usr/local/etc/php/php.ini
|
||||||
|
|
||||||
COPY docker/app/install-composer.sh /usr/local/bin/docker-app-install-composer
|
COPY docker/app/install-composer.sh /usr/local/bin/docker-app-install-composer
|
||||||
RUN chmod +x /usr/local/bin/docker-app-install-composer
|
RUN chmod +x /usr/local/bin/docker-app-install-composer
|
||||||
|
|
||||||
RUN set -xe \
|
RUN set -xe \
|
||||||
&& apk add --no-cache --virtual .fetch-deps openssl \
|
|
||||||
&& docker-app-install-composer \
|
&& docker-app-install-composer \
|
||||||
&& mv composer.phar /usr/local/bin/composer \
|
&& mv composer.phar /usr/local/bin/composer
|
||||||
&& apk del .fetch-deps
|
|
||||||
|
|
||||||
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
|
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
|
||||||
ENV COMPOSER_ALLOW_SUPERUSER 1
|
ENV COMPOSER_ALLOW_SUPERUSER 1
|
||||||
@ -42,24 +42,20 @@ RUN composer global require "hirak/prestissimo:^0.3" --prefer-dist --no-progress
|
|||||||
|
|
||||||
WORKDIR /srv/app
|
WORKDIR /srv/app
|
||||||
|
|
||||||
COPY composer.* ./
|
COPY . .
|
||||||
|
# Cleanup unneeded files
|
||||||
|
RUN rm -Rf docker/
|
||||||
|
|
||||||
RUN mkdir -p \
|
# Download the Symfony skeleton
|
||||||
var/cache \
|
ENV SKELETON_COMPOSER_JSON https://raw.githubusercontent.com/symfony/skeleton/v3.3.2/composer.json
|
||||||
var/logs \
|
RUN [ -f composer.json ] || php -r "copy('$SKELETON_COMPOSER_JSON', 'composer.json');"
|
||||||
var/sessions \
|
|
||||||
&& composer install --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress --no-suggest \
|
RUN mkdir -p var/cache var/logs var/sessions \
|
||||||
|
&& composer install --prefer-dist --no-dev --no-progress --no-suggest --optimize-autoloader --classmap-authoritative --no-interaction \
|
||||||
&& composer clear-cache \
|
&& composer clear-cache \
|
||||||
# Permissions hack because setfacl does not work on Mac and Windows
|
# Permissions hack because setfacl does not work on Mac and Windows
|
||||||
&& chown -R www-data var
|
&& chown -R www-data var
|
||||||
|
|
||||||
COPY etc etc/
|
|
||||||
COPY src src/
|
|
||||||
COPY var var/
|
|
||||||
COPY web web/
|
|
||||||
|
|
||||||
RUN composer dump-autoload --optimize --classmap-authoritative --no-dev
|
|
||||||
|
|
||||||
COPY docker/app/docker-entrypoint.sh /usr/local/bin/docker-app-entrypoint
|
COPY docker/app/docker-entrypoint.sh /usr/local/bin/docker-app-entrypoint
|
||||||
RUN chmod +x /usr/local/bin/docker-app-entrypoint
|
RUN chmod +x /usr/local/bin/docker-app-entrypoint
|
||||||
|
|
||||||
|
4
Dockerfile.nginx
Normal file
4
Dockerfile.nginx
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
FROM nginx:1.13-alpine
|
||||||
|
|
||||||
|
COPY docker/nginx/conf.d /etc/nginx/conf.d/
|
||||||
|
COPY public /srv/app/public/
|
@ -1,49 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "dunglas/symfony-docker-skeleton",
|
|
||||||
"type": "project",
|
|
||||||
"license": "proprietary",
|
|
||||||
"description": "Project description",
|
|
||||||
"require": {
|
|
||||||
"php": "^7.1.3",
|
|
||||||
"symfony/flex": "^1.0",
|
|
||||||
"symfony/framework-bundle": "^3.3",
|
|
||||||
"symfony/yaml": "^3.3"
|
|
||||||
},
|
|
||||||
"config": {
|
|
||||||
"preferred-install": {
|
|
||||||
"*": "dist"
|
|
||||||
},
|
|
||||||
"sort-packages": true
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"App\\": "src/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload-dev": {
|
|
||||||
"psr-4": {
|
|
||||||
"App\\Tests\\": "tests/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"auto-scripts": [
|
|
||||||
],
|
|
||||||
"post-install-cmd": [
|
|
||||||
"@auto-scripts"
|
|
||||||
],
|
|
||||||
"post-update-cmd": [
|
|
||||||
"@auto-scripts"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"conflict": {
|
|
||||||
"symfony/symfony": "*",
|
|
||||||
"symfony/twig-bundle": "<3.3",
|
|
||||||
"symfony/debug": "<3.3"
|
|
||||||
},
|
|
||||||
"extra": {
|
|
||||||
"symfony": {
|
|
||||||
"id": "",
|
|
||||||
"allow-contrib": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,16 +4,9 @@ services:
|
|||||||
app:
|
app:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./Dockerfile
|
|
||||||
#depends_on:
|
|
||||||
# - db
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
volumes:
|
volumes:
|
||||||
# Comment out the next line in production
|
# Comment out the next line in production
|
||||||
- ./:/srv/app/:rw
|
- ./:/srv/app:rw
|
||||||
# This is for assets:install
|
|
||||||
- ./web/:/srv/app/web/:rw
|
|
||||||
# If you develop on Linux, comment out the following volumes to just use bind-mounted project directory from host
|
# If you develop on Linux, comment out the following volumes to just use bind-mounted project directory from host
|
||||||
- /srv/app/var/
|
- /srv/app/var/
|
||||||
- /srv/app/var/cache/
|
- /srv/app/var/cache/
|
||||||
@ -23,31 +16,11 @@ services:
|
|||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
build:
|
build:
|
||||||
context: ./docker/nginx
|
context: .
|
||||||
dockerfile: ./Dockerfile
|
dockerfile: ./Dockerfile.nginx
|
||||||
volumes:
|
volumes:
|
||||||
# Comment out the next line in production
|
# Comment out the next line in production
|
||||||
- ./docker/nginx/conf.d:/etc/nginx/conf.d:ro
|
- ./docker/nginx/conf.d:/etc/nginx/conf.d:ro
|
||||||
- ./web:/srv/app/web:ro
|
- ./public:/srv/app/public:ro
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- '80:80'
|
||||||
|
|
||||||
# Uncomment the following lines to add a MySQL container
|
|
||||||
#db:
|
|
||||||
# build:
|
|
||||||
# context: ./docker/db
|
|
||||||
# dockerfile: ./Dockerfile
|
|
||||||
# environment:
|
|
||||||
# - MYSQL_DATABASE=app
|
|
||||||
# # You should definitely change the password in production
|
|
||||||
# - MYSQL_PASSWORD=symfony
|
|
||||||
# - MYSQL_RANDOM_ROOT_PASSWORD=true
|
|
||||||
# - MYSQL_USER=symfony
|
|
||||||
# volumes:
|
|
||||||
# - db-data:/var/lib/mysql:rw
|
|
||||||
# # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
|
|
||||||
# # - ./docker/db/data:/var/lib/mysql:rw
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
app-web: {}
|
|
||||||
#db-data: {}
|
|
||||||
|
@ -7,11 +7,12 @@ if [ "${1#-}" != "$1" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = 'php-fpm' ] || [ "$1" = 'bin/console' ]; then
|
if [ "$1" = 'php-fpm' ] || [ "$1" = 'bin/console' ]; then
|
||||||
if [ "$APP_ENV" = 'prod' ]; then
|
# The first time volumes are mounted, dependencies need to be reinstalled
|
||||||
composer install --prefer-dist --no-dev --no-progress --no-suggest --optimize-autoloader --classmap-authoritative --no-interaction
|
if [ ! -f composer.json ]; then
|
||||||
else
|
rm -Rf vendor/*
|
||||||
composer install --prefer-dist --no-progress --no-suggest --no-interaction
|
php -r "copy('$SKELETON_COMPOSER_JSON', 'composer.json');"
|
||||||
fi
|
composer install --prefer-dist --no-progress --no-suggest --no-interaction
|
||||||
|
fi
|
||||||
|
|
||||||
# Permissions hack because setfacl does not work on Mac and Windows
|
# Permissions hack because setfacl does not work on Mac and Windows
|
||||||
chown -R www-data var
|
chown -R www-data var
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# Origin: https://github.com/composer/composer/blob/master/doc/faqs/how-to-install-composer-programmatically.md
|
# Origin: https://github.com/composer/composer/blob/master/doc/faqs/how-to-install-composer-programmatically.md
|
||||||
# Licence: MIT
|
# Licence: MIT
|
||||||
|
|
||||||
EXPECTED_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig)
|
EXPECTED_SIGNATURE=$(php -r "echo trim(file_get_contents('https://composer.github.io/installer.sig'));")
|
||||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||||
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")
|
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")
|
||||||
|
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
**/*.log
|
|
||||||
**/*.md
|
|
||||||
**/*.sql.gz
|
|
||||||
**/._*
|
|
||||||
**/.DS_Store
|
|
||||||
**/.gitignore
|
|
||||||
**/Thumbs.db
|
|
||||||
.dockerignore
|
|
||||||
data/
|
|
||||||
Dockerfile
|
|
1
docker/db/.gitignore
vendored
1
docker/db/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
data/
|
|
@ -1,6 +0,0 @@
|
|||||||
FROM mysql:5.7
|
|
||||||
|
|
||||||
COPY docker-healthcheck.sh /usr/local/bin/docker-healthcheck
|
|
||||||
RUN chmod +x /usr/local/bin/docker-healthcheck
|
|
||||||
|
|
||||||
HEALTHCHECK CMD ["docker-healthcheck"]
|
|
@ -1,30 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Copyright (c) 2014-2016 Docker, Inc.
|
|
||||||
# Origin: https://github.com/docker-library/healthcheck/blob/master/mysql/docker-healthcheck
|
|
||||||
# Licence: MIT
|
|
||||||
|
|
||||||
set -eo pipefail
|
|
||||||
|
|
||||||
if [ "$MYSQL_RANDOM_ROOT_PASSWORD" ] && [ -z "$MYSQL_USER" ] && [ -z "$MYSQL_PASSWORD" ]; then
|
|
||||||
# there's no way we can guess what the random MySQL password was
|
|
||||||
echo >&2 'healthcheck error: cannot determine random root password (and MYSQL_USER and MYSQL_PASSWORD were not set)'
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
host="$(hostname --ip-address || echo '127.0.0.1')"
|
|
||||||
user="${MYSQL_USER:-root}"
|
|
||||||
export MYSQL_PWD="${MYSQL_PASSWORD:-$MYSQL_ROOT_PASSWORD}"
|
|
||||||
|
|
||||||
args=(
|
|
||||||
# force mysql to not use the local "mysqld.sock" (test "external" connectibility)
|
|
||||||
-h"$host"
|
|
||||||
-u"$user"
|
|
||||||
--silent
|
|
||||||
)
|
|
||||||
|
|
||||||
if select="$(echo 'SELECT 1' | mysql "${args[@]}")" && [ "$select" = '1' ]; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit 1
|
|
@ -1,3 +0,0 @@
|
|||||||
FROM nginx:1.13-alpine
|
|
||||||
|
|
||||||
COPY conf.d /etc/nginx/conf.d/
|
|
@ -1,9 +1,9 @@
|
|||||||
server {
|
server {
|
||||||
root /srv/app/web;
|
root /srv/app/public;
|
||||||
resolver 127.0.0.11;
|
resolver 127.0.0.11;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
# try to serve file directly, fallback to app.php
|
# try to serve file directly, fallback to index.php
|
||||||
try_files $uri /index.php$is_args$args;
|
try_files $uri /index.php$is_args$args;
|
||||||
}
|
}
|
||||||
location ~ ^/index\.php(/|$) {
|
location ~ ^/index\.php(/|$) {
|
||||||
@ -20,7 +20,7 @@ server {
|
|||||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||||
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
||||||
# Prevents URIs that include the front controller. This will 404:
|
# Prevents URIs that include the front controller. This will 404:
|
||||||
# http://domain.tld/app.php/some-path
|
# http://domain.tld/index.php/some-path
|
||||||
# Remove the internal directive to allow URIs like this
|
# Remove the internal directive to allow URIs like this
|
||||||
internal;
|
internal;
|
||||||
}
|
}
|
||||||
|
0
public/.gitignore
vendored
Normal file
0
public/.gitignore
vendored
Normal file
Loading…
x
Reference in New Issue
Block a user