diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..1d085ca --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +** diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8e233fb --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/docker-compose.yaml b/docker-compose.yaml index 9d1e16e..322ff85 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -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