Create dev docker api image

This commit is contained in:
Kacper Donat 2020-11-29 23:50:57 +01:00
parent 69d51636f2
commit eaf58bd477
6 changed files with 89 additions and 25 deletions

View File

@ -1,4 +1,2 @@
/vendor/
/var/*.db
/var/cache/*
/var/log/
/var/

34
api/dev.Dockerfile Normal file
View File

@ -0,0 +1,34 @@
FROM php:7.4-fpm-alpine
ENV APP_ENV=dev
ENV DATABASE_URL="sqlite:///var/db/app.db"
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

View File

@ -1,26 +1,19 @@
FROM php:7.4-fpm-alpine
ENV APP_ENV=prod
ENV DATABASE_URL="sqlite:///var/db/app.db"
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;
docker-php-ext-install bcmath intl opcache zip sockets && \
apk del --purge autoconf g++ make;
# 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
COPY . .
RUN composer install --no-dev --no-scripts --no-plugins --prefer-dist --no-progress --no-interaction && \
composer dump-autoload --optimize && \
composer check-platform-reqs && \
php bin/console cache:warmup
# Timezone
RUN ln -snf /usr/share/zoneinfo/Europe/Warsaw /etc/localtime &&

View File

@ -1,5 +1,8 @@
FROM php:7.4-alpine
ENV APP_ENV=prod
ENV DATABASE_URL="sqlite:///var/db/app.db"
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
@ -12,9 +15,6 @@ 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

View File

@ -14,6 +14,9 @@
"cerbero/json-objects": {
"version": "v1.1.2"
},
"composer/package-versions-deprecated": {
"version": "1.11.99.1"
},
"dflydev/fig-cookies": {
"version": "v2.0.1"
},
@ -83,6 +86,9 @@
"doctrine/reflection": {
"version": "v1.0.0"
},
"doctrine/sql-formatter": {
"version": "1.1.1"
},
"exsyst/swagger": {
"version": "v0.4.1"
},
@ -154,6 +160,12 @@
"kylekatarnls/update-helper": {
"version": "1.2.0"
},
"laminas/laminas-diactoros": {
"version": "2.5.0"
},
"laminas/laminas-zendframework-bridge": {
"version": "1.1.1"
},
"monolog/monolog": {
"version": "1.23.0"
},
@ -196,6 +208,9 @@
"psr/container": {
"version": "1.0.0"
},
"psr/http-factory": {
"version": "1.0.1"
},
"psr/http-message": {
"version": "1.0.1"
},
@ -223,6 +238,12 @@
"ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b"
}
},
"spiral/goridge": {
"version": "v2.4.5"
},
"spiral/roadrunner": {
"version": "v1.8.4"
},
"symfony/asset": {
"version": "v4.1.4"
},
@ -250,6 +271,9 @@
"symfony/dependency-injection": {
"version": "v4.1.3"
},
"symfony/deprecation-contracts": {
"version": "v2.2.0"
},
"symfony/doctrine-bridge": {
"version": "v4.1.4"
},
@ -289,6 +313,9 @@
"ref": "87c585d24de9f43bca80ebcfd5cf5cb39445d95f"
}
},
"symfony/http-client-contracts": {
"version": "v2.3.1"
},
"symfony/http-foundation": {
"version": "v4.1.3"
},
@ -319,15 +346,24 @@
"symfony/orm-pack": {
"version": "v1.0.5"
},
"symfony/polyfill-intl-grapheme": {
"version": "v1.20.0"
},
"symfony/polyfill-intl-idn": {
"version": "v1.13.1"
},
"symfony/polyfill-intl-normalizer": {
"version": "v1.20.0"
},
"symfony/polyfill-mbstring": {
"version": "v1.9.0"
},
"symfony/polyfill-php73": {
"version": "v1.13.1"
},
"symfony/polyfill-php80": {
"version": "v1.20.0"
},
"symfony/profiler-pack": {
"version": "v1.0.4"
},
@ -361,6 +397,9 @@
"symfony/stopwatch": {
"version": "v4.1.12"
},
"symfony/string": {
"version": "v5.1.8"
},
"symfony/translation": {
"version": "3.3",
"recipe": {

View File

@ -13,7 +13,7 @@ services:
api:
build:
context: ./api
dockerfile: fpm.Dockerfile
dockerfile: dev.Dockerfile
env_file:
- ./docker/php/.env
volumes: