From 6bdbaa9b7f3c11a59c355b804b81044ebc9eeb40 Mon Sep 17 00:00:00 2001 From: Vadims Date: Wed, 8 May 2024 16:00:01 +0200 Subject: [PATCH] misc: docker files --- .docker/php/config/php.ini | 2 +- .docker/php/dev.Dockerfile | 1 + .docker/php/entrypoint.sh | 16 ++++------------ .docker/php/{Dockerfile => prod.Dockerfile} | 3 ++- .github/workflows/docker_image_publish.yaml | 2 +- Makefile | 4 ++-- docker-compose.yaml | 1 - 7 files changed, 11 insertions(+), 18 deletions(-) rename .docker/php/{Dockerfile => prod.Dockerfile} (93%) diff --git a/.docker/php/config/php.ini b/.docker/php/config/php.ini index 8647d84..5e461c4 100644 --- a/.docker/php/config/php.ini +++ b/.docker/php/config/php.ini @@ -425,7 +425,7 @@ max_input_time = 60 ; Maximum amount of memory a script may consume ; https://php.net/memory-limit -memory_limit = 256M +memory_limit = 512M ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Error handling and logging ; diff --git a/.docker/php/dev.Dockerfile b/.docker/php/dev.Dockerfile index db93512..fc0b6fe 100644 --- a/.docker/php/dev.Dockerfile +++ b/.docker/php/dev.Dockerfile @@ -2,6 +2,7 @@ FROM php:8.3.6-cli-alpine3.18 RUN --mount=type=bind,from=mlocati/php-extension-installer:1.5,source=/usr/bin/install-php-extensions,target=/usr/local/bin/install-php-extensions \ install-php-extensions pdo pdo_mysql zip opcache xsl dom exif intl pcntl bcmath sockets && \ + apk add --no-cache git unzip && \ apk del --no-cache ${PHPIZE_DEPS} ${BUILD_DEPENDS} WORKDIR /var/www/geo-service diff --git a/.docker/php/entrypoint.sh b/.docker/php/entrypoint.sh index 5c397ca..340f5f9 100644 --- a/.docker/php/entrypoint.sh +++ b/.docker/php/entrypoint.sh @@ -1,17 +1,9 @@ #!/usr/bin/env sh -if [ -d "vendor" ]; then - echo "Vendor folder exists. Skipping 'composer install'." -else - composer install - bin/console assets:install -fi +composer install +bin/console assets:install -if [ -f "bin/rr" ]; then - echo "RR binary exists. Skipping 'vendor/bin/rr get-binary'." -else - vendor/bin/rr get-binary -f v2024.1.1 --location bin - chmod +x bin/rr -fi +vendor/bin/rr get-binary -f v2024.1.1 --location bin +chmod +x bin/rr bin/rr serve -c .rr.dev.yaml diff --git a/.docker/php/Dockerfile b/.docker/php/prod.Dockerfile similarity index 93% rename from .docker/php/Dockerfile rename to .docker/php/prod.Dockerfile index 28e74ac..37a0336 100644 --- a/.docker/php/Dockerfile +++ b/.docker/php/prod.Dockerfile @@ -2,6 +2,7 @@ FROM php:8.3.6-cli-alpine3.18 RUN --mount=type=bind,from=mlocati/php-extension-installer:1.5,source=/usr/bin/install-php-extensions,target=/usr/local/bin/install-php-extensions \ install-php-extensions pdo pdo_mysql zip opcache xsl dom exif intl pcntl bcmath sockets && \ + apk add --no-cache git unzip && \ apk del --no-cache ${PHPIZE_DEPS} ${BUILD_DEPENDS} WORKDIR /var/www/geo-service @@ -19,6 +20,6 @@ RUN composer install --optimize-autoloader --no-dev --prefer-dist \ COPY --from=ghcr.io/roadrunner-server/roadrunner:2024.1.1 /usr/bin/rr ./bin/rr -EXPOSE 8080/tcp +EXPOSE 80/tcp CMD ./bin/rr serve -c .rr.yaml diff --git a/.github/workflows/docker_image_publish.yaml b/.github/workflows/docker_image_publish.yaml index e277878..a5fdc57 100644 --- a/.github/workflows/docker_image_publish.yaml +++ b/.github/workflows/docker_image_publish.yaml @@ -28,7 +28,7 @@ jobs: uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 with: context: . - file: .docker/php/Dockerfile + file: .docker/php/prod.Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Makefile b/Makefile index 19c8e4c..5e110ae 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,8 @@ dev: .PHONY: coldstart coldstart: - rm -rf vendor - rm bin/rr + -rm -rf vendor + -rm bin/rr @docker compose up -d @docker exec geo-service-app-dev sh -c "composer install" @docker exec geo-service-app-dev sh -c "bin/console d:m:m" diff --git a/docker-compose.yaml b/docker-compose.yaml index 2de8162..68e9d38 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -3,7 +3,6 @@ version: "3" networks: geo-service-network: - services: geo-service-app: build: