Skip to content

Commit

Permalink
Merge branch 'improve-docker' into github-workflow-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
scottaubrey committed Aug 14, 2024
2 parents 3fb0dc0 + b9ee038 commit db5dbaa
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 8 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/build/
/config.php
/index.json
/.php_cs.cache
/var/
/vendor/
!.gitkeep
46 changes: 38 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,51 @@
FROM php:7.4-cli
##
## base image setup
#
FROM php:7.4-cli as base

USER root

RUN apt update && apt install libgearman-dev zip unzip gearman-tools bc procps jq apache2-utils retry -y && pecl install gearman

RUN docker-php-ext-enable gearman \
&& docker-php-ext-configure pcntl --enable-pcntl \
&& docker-php-ext-install pcntl
RUN apt update && apt install libgearman-dev zip unzip gearman-tools bc procps jq apache2-utils retry -y && rm -rf /var/lib/apt/lists/*
RUN pecl install gearman && docker-php-ext-enable gearman
RUN docker-php-ext-configure pcntl --enable-pcntl && docker-php-ext-install pcntl

COPY .docker/php.ini /usr/local/etc/php/php.ini

WORKDIR /app


##
## Composer Dependency builder
#
FROM base as deps
COPY composer.json composer.json
COPY composer.lock composer.lock
COPY --from=composer:2.4 /usr/bin/composer /usr/bin/composer
COPY . /app/
RUN composer install

##
## Application builder
#
FROM base as app
COPY . /app/
COPY --from=deps /app/vendor /app/vendor

##
## Dev environment
#
FROM app as dev

# Install additional tools needed for tests
RUN apt update && apt install apache2-utils retry -y

# Use the PHP dev server to run the app
CMD ["php", "-S", "0.0.0.0:80", "-t", "./web", "./web/app_dev.php"]
EXPOSE 80

##
## Prod environment
#
FROM app as prod

# TODO: Replace with a more production ready webserver
CMD ["php", "-S", "0.0.0.0:80", "-t", "./web", "./web/app_dev.php"]
EXPOSE 80
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ services:
build:
context: .
dockerfile: Dockerfile
target: dev
environment:
- GEARMAN_HOST=gearman
- GATEWAY_HOST=api-dummy:8080
Expand Down

0 comments on commit db5dbaa

Please sign in to comment.