Change docker base to alpine linux
This commit is contained in:
parent
a865c5ec8d
commit
69d51636f2
4
api/.dockerignore
Normal file
4
api/.dockerignore
Normal file
@ -0,0 +1,4 @@
|
||||
/vendor/
|
||||
/var/*.db
|
||||
/var/cache/*
|
||||
/var/log/
|
3
api/.gitignore
vendored
3
api/.gitignore
vendored
@ -8,3 +8,6 @@
|
||||
/public/*
|
||||
!/public/index.php
|
||||
|
||||
###> baldinof/roadrunner-bundle ###
|
||||
/bin/rr
|
||||
###< baldinof/roadrunner-bundle ###
|
||||
|
11
api/.rr.dev.yaml
Normal file
11
api/.rr.dev.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
include:
|
||||
- .rr.yaml
|
||||
|
||||
reload:
|
||||
enabled: true
|
||||
interval: 1s
|
||||
patterns: [".php"]
|
||||
services:
|
||||
http:
|
||||
dirs: ["."]
|
||||
recursive: true
|
13
api/.rr.yaml
Normal file
13
api/.rr.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
http:
|
||||
address: "0.0.0.0:8080"
|
||||
|
||||
uploads:
|
||||
forbid: [".php", ".exe", ".bat"]
|
||||
|
||||
workers:
|
||||
command: "php bin/console baldinof:roadrunner:worker"
|
||||
relay: "unix://var/roadrunner.sock"
|
||||
|
||||
static:
|
||||
dir: "public"
|
||||
forbid: [".php", ".htaccess"]
|
@ -1,37 +0,0 @@
|
||||
FROM php:7.3-fpm
|
||||
|
||||
ARG XDEBUG_REMOTE_HOST="172.17.0.1"
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends git zip libzip-dev
|
||||
|
||||
RUN docker-php-ext-install zip
|
||||
|
||||
# XDebug
|
||||
RUN pecl install xdebug-2.9.0 && docker-php-ext-enable xdebug
|
||||
RUN echo "xdebug.remote_enable = 1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
|
||||
echo "xdebug.remote_host = ${XDEBUG_REMOTE_HOST}" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini;
|
||||
|
||||
# Blackfire
|
||||
RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
|
||||
&& curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version \
|
||||
&& mkdir -p /tmp/blackfire \
|
||||
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
|
||||
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
|
||||
&& printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/blackfire.ini \
|
||||
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
|
||||
|
||||
#Composer
|
||||
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
|
||||
&& php composer-setup.php \
|
||||
&& php -r "unlink('composer-setup.php');" \
|
||||
&& mv composer.phar /usr/local/bin/composer \
|
||||
&& chmod +x /usr/local/bin/composer
|
||||
|
||||
# Timezone
|
||||
RUN ln -snf /usr/share/zoneinfo/Europe/Warsaw /etc/localtime
|
||||
RUN echo "date.timezone = Europe/Warsaw" >> /usr/local/etc/php/conf.d/datetime.ini;
|
||||
|
||||
WORKDIR /var/www
|
||||
|
||||
EXPOSE 9001
|
@ -7,15 +7,19 @@
|
||||
"ext-ctype": "*",
|
||||
"ext-iconv": "*",
|
||||
"ext-json": "*",
|
||||
"baldinof/roadrunner-bundle": "^1.3",
|
||||
"cerbero/json-objects": "^1.1",
|
||||
"doctrine/doctrine-cache-bundle": "^1.4",
|
||||
"jms/serializer-bundle": "^3.5",
|
||||
"kadet/functional": "dev-master",
|
||||
"nelmio/api-doc-bundle": "^3.5",
|
||||
"nesbot/carbon": "^1.33",
|
||||
"ocramius/proxy-manager": "^2.0",
|
||||
"sensio/framework-extra-bundle": "^5.2",
|
||||
"spiral/roadrunner": "^1.8",
|
||||
"symfony/asset": "^4.4",
|
||||
"symfony/console": "^4.4",
|
||||
"symfony/dotenv": "^4.4",
|
||||
"symfony/flex": "^1.1",
|
||||
"symfony/framework-bundle": "^4.4",
|
||||
"symfony/monolog-bundle": "^3.3",
|
||||
@ -23,10 +27,7 @@
|
||||
"symfony/profiler-pack": "^1.0",
|
||||
"symfony/twig-bundle": "^4.4",
|
||||
"symfony/yaml": "^4.4",
|
||||
"tightenco/collect": "^5.6",
|
||||
"kadet/functional": "dev-master",
|
||||
"spiral/roadrunner": "^1.8",
|
||||
"symfony/dotenv": "^4.4"
|
||||
"tightenco/collect": "^5.6"
|
||||
},
|
||||
"config": {
|
||||
"preferred-install": {
|
||||
@ -43,6 +44,7 @@
|
||||
"App\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php",
|
||||
"./src/Functions/index.php"
|
||||
]
|
||||
},
|
||||
|
1391
api/composer.lock
generated
1391
api/composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -11,4 +11,5 @@ return [
|
||||
Nelmio\ApiDocBundle\NelmioApiDocBundle::class => ['all' => true],
|
||||
JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true],
|
||||
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
|
||||
Baldinof\RoadRunnerBundle\BaldinofRoadRunnerBundle::class => ['all' => true],
|
||||
];
|
||||
|
18
api/config/packages/baldinof_road_runner.yaml
Normal file
18
api/config/packages/baldinof_road_runner.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
baldinof_road_runner:
|
||||
# The kernel is preserved between requests. Change this to `true`
|
||||
# if you want to reboot it, and use a fresh container on each request.
|
||||
should_reboot_kernel: false
|
||||
|
||||
# Integrations are automatically detected, depending on installed bundle & current configuration
|
||||
# See https://github.com/baldinof/roadrunner-bundle#integrations
|
||||
default_integrations: true
|
||||
|
||||
# Allow to send prometheus metrics to the master RoadRunner process,
|
||||
# via a `Spiral\RoadRunner\MetricsInterface` service.
|
||||
# See https://github.com/baldinof/roadrunner-bundle#metrics
|
||||
metrics_enabled: false
|
||||
|
||||
# You can use middlewares to manipulate PSR requests & responses.
|
||||
# See https://github.com/baldinof/roadrunner-bundle#middlewares
|
||||
# middlewares:
|
||||
# - App\Middleware\YourMiddleware
|
31
api/fpm.Dockerfile
Normal file
31
api/fpm.Dockerfile
Normal file
@ -0,0 +1,31 @@
|
||||
FROM php:7.4-fpm-alpine
|
||||
|
||||
RUN apk add --no-cache autoconf openssl-dev g++ make pcre-dev icu-dev zlib-dev libzip-dev git && \
|
||||
docker-php-ext-install bcmath intl opcache zip sockets;
|
||||
|
||||
# XDebug
|
||||
RUN pecl install xdebug-3.0.0 && docker-php-ext-enable xdebug
|
||||
RUN echo "xdebug.mode = develop,debug" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
|
||||
echo "xdebug.discover_client_host = On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini;
|
||||
|
||||
RUN apk del --purge autoconf g++ make
|
||||
|
||||
# Blackfire
|
||||
RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
|
||||
&& curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version \
|
||||
&& mkdir -p /tmp/blackfire \
|
||||
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
|
||||
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
|
||||
&& printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/blackfire.ini \
|
||||
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
|
||||
|
||||
#Composer
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
# Timezone
|
||||
RUN ln -snf /usr/share/zoneinfo/Europe/Warsaw /etc/localtime &&
|
||||
echo "date.timezone = Europe/Warsaw" >> /usr/local/etc/php/conf.d/datetime.ini;
|
||||
|
||||
WORKDIR /var/www
|
||||
|
||||
EXPOSE 9001
|
24
api/rr.Dockerfile
Normal file
24
api/rr.Dockerfile
Normal file
@ -0,0 +1,24 @@
|
||||
FROM php:7.4-alpine
|
||||
|
||||
RUN apk add --no-cache autoconf openssl-dev g++ make pcre-dev icu-dev zlib-dev libzip-dev git && \
|
||||
docker-php-ext-install bcmath intl opcache zip sockets && \
|
||||
apk del --purge autoconf g++ make
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
COPY . .
|
||||
|
||||
RUN composer install --no-dev --no-scripts --no-plugins --prefer-dist --no-progress --no-interaction
|
||||
RUN ./vendor/bin/rr get-binary --location /usr/local/bin
|
||||
|
||||
ENV APP_ENV=prod
|
||||
ENV DATABASE_URL="sqlite:///var/db/app.db"
|
||||
|
||||
RUN composer dump-autoload --optimize && \
|
||||
composer check-platform-reqs && \
|
||||
php bin/console cache:warmup
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["rr", "serve"]
|
@ -1,7 +1,22 @@
|
||||
{
|
||||
"baldinof/roadrunner-bundle": {
|
||||
"version": "1.2",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes-contrib",
|
||||
"branch": "master",
|
||||
"version": "1.2",
|
||||
"ref": "47c159c44eb9e6902828da4acbb4199757dd378f"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/baldinof_road_runner.yaml"
|
||||
]
|
||||
},
|
||||
"cerbero/json-objects": {
|
||||
"version": "v1.1.2"
|
||||
},
|
||||
"dflydev/fig-cookies": {
|
||||
"version": "v2.0.1"
|
||||
},
|
||||
"doctrine/annotations": {
|
||||
"version": "1.0",
|
||||
"recipe": {
|
||||
@ -163,6 +178,9 @@
|
||||
"php": {
|
||||
"version": "7.3.12"
|
||||
},
|
||||
"php-http/discovery": {
|
||||
"version": "1.13.0"
|
||||
},
|
||||
"phpdocumentor/reflection-common": {
|
||||
"version": "1.0.1"
|
||||
},
|
||||
@ -181,6 +199,12 @@
|
||||
"psr/http-message": {
|
||||
"version": "1.0.1"
|
||||
},
|
||||
"psr/http-server-handler": {
|
||||
"version": "1.0.1"
|
||||
},
|
||||
"psr/http-server-middleware": {
|
||||
"version": "1.0.1"
|
||||
},
|
||||
"psr/log": {
|
||||
"version": "1.0.2"
|
||||
},
|
||||
@ -301,9 +325,6 @@
|
||||
"symfony/polyfill-mbstring": {
|
||||
"version": "v1.9.0"
|
||||
},
|
||||
"symfony/polyfill-php72": {
|
||||
"version": "v1.9.0"
|
||||
},
|
||||
"symfony/polyfill-php73": {
|
||||
"version": "v1.13.1"
|
||||
},
|
||||
@ -316,6 +337,9 @@
|
||||
"symfony/property-info": {
|
||||
"version": "v4.1.3"
|
||||
},
|
||||
"symfony/psr-http-message-bridge": {
|
||||
"version": "v2.0.2"
|
||||
},
|
||||
"symfony/routing": {
|
||||
"version": "4.0",
|
||||
"recipe": {
|
||||
|
@ -11,7 +11,9 @@ services:
|
||||
- ./docker/nginx/cojedzie.conf:/etc/nginx/conf.d/cojedzie.conf
|
||||
|
||||
api:
|
||||
build: ./api
|
||||
build:
|
||||
context: ./api
|
||||
dockerfile: fpm.Dockerfile
|
||||
env_file:
|
||||
- ./docker/php/.env
|
||||
volumes:
|
||||
|
@ -7,6 +7,11 @@ server {
|
||||
try_files $uri $uri/ index.php$is_args$args;
|
||||
}
|
||||
|
||||
location /_profiler/ {
|
||||
root /var/www/api/public/;
|
||||
try_files $uri $uri/ index.php$is_args$args;
|
||||
}
|
||||
|
||||
location /bundles/ {
|
||||
root /var/www/api/public/;
|
||||
try_files $uri $uri/;
|
||||
|
Loading…
Reference in New Issue
Block a user