Skip to content

Commit

Permalink
build: Add development container to docker-compose.yaml (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
BacLuc authored Mar 8, 2024
1 parent 7b8cf62 commit ec2877a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# renovate: datasource=docker depName=php
ARG PHP_VERSION=8.3.2

# renovate: datasource=docker depName=alpine
ARG ALPINE_VERSION=3.18

FROM php:${PHP_VERSION}-alpine${ALPINE_VERSION}

# php extensions installer: https://github.com/mlocati/docker-php-extension-installer
COPY --from=mlocati/php-extension-installer --link /usr/bin/install-php-extensions /usr/local/bin/

RUN set -eux; \
install-php-extensions pdo_mysql mongodb

# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
ENV PATH="${PATH}:/root/.composer/vendor/bin"
ENV COMPOSER_HOME=/tmp/composer
ENV COMPOSER_CACHE_DIR=/tmp/composer/cache
RUN mkdir -p /tmp/composer/cache
RUN chmod ugo+w /tmp/composer/cache

COPY --from=composer /usr/bin/composer /usr/bin/composer

CMD ["php"]
13 changes: 13 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@ version: '3.1'

# To keep in sync with .gitHub/workflows/tests.yaml
services:
php:
build: .
volumes:
- .:/app
- ./.cache/composer:/tmp/composer/cache:delegated
working_dir: /app
environment:
- DATABASE_URL=mysql://root:password@mysql/hautelook_alice_bundle
profiles:
- php
user: ${USER_ID:-1000}
network_mode: host

mysql:
image: mysql:8.0
platform: linux/amd64
Expand Down

0 comments on commit ec2877a

Please sign in to comment.