From d600f7ef63aeab4e97f273107e63e70040c52088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20H=C3=A9lias?= Date: Mon, 17 Oct 2022 11:17:15 +0200 Subject: [PATCH] feat: improve Dockerfile link on copy --- .github/workflows/ci.yml | 2 +- Dockerfile | 27 ++++++++++++++------------- README.md | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 484ad88..0d8192d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Pull images run: docker compose pull - name: Start services diff --git a/Dockerfile b/Dockerfile index fc53ae1..02a9350 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,9 @@ -# the different stages of this Dockerfile are meant to be built into separate images +#syntax=docker/dockerfile:1.4 + +# The different stages of this Dockerfile are meant to be built into separate images # https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage # https://docs.docker.com/compose/compose-file/#target - # https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact ARG PHP_VERSION=8.1 ARG CADDY_VERSION=2 @@ -47,18 +48,18 @@ RUN set -eux; \ ###< recipes ### RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" -COPY docker/php/conf.d/app.ini $PHP_INI_DIR/conf.d/ -COPY docker/php/conf.d/app.prod.ini $PHP_INI_DIR/conf.d/ +COPY --link docker/php/conf.d/app.ini $PHP_INI_DIR/conf.d/ +COPY --link docker/php/conf.d/app.prod.ini $PHP_INI_DIR/conf.d/ -COPY docker/php/php-fpm.d/zz-docker.conf /usr/local/etc/php-fpm.d/zz-docker.conf +COPY --link docker/php/php-fpm.d/zz-docker.conf /usr/local/etc/php-fpm.d/zz-docker.conf RUN mkdir -p /var/run/php -COPY docker/php/docker-healthcheck.sh /usr/local/bin/docker-healthcheck +COPY --link docker/php/docker-healthcheck.sh /usr/local/bin/docker-healthcheck RUN chmod +x /usr/local/bin/docker-healthcheck HEALTHCHECK --interval=10s --timeout=3s --retries=3 CMD ["docker-healthcheck"] -COPY docker/php/docker-entrypoint.sh /usr/local/bin/docker-entrypoint +COPY --link docker/php/docker-entrypoint.sh /usr/local/bin/docker-entrypoint RUN chmod +x /usr/local/bin/docker-entrypoint ENTRYPOINT ["docker-entrypoint"] @@ -68,7 +69,7 @@ CMD ["php-fpm"] ENV COMPOSER_ALLOW_SUPERUSER=1 ENV PATH="${PATH}:/root/.composer/vendor/bin" -COPY --from=composer:2 /usr/bin/composer /usr/bin/composer +COPY --from=composer:2 --link /usr/bin/composer /usr/bin/composer # prevent the reinstallation of vendors at every changes in the source code COPY composer.* symfony.* ./ @@ -79,7 +80,7 @@ RUN set -eux; \ fi # copy sources -COPY . . +COPY --link . . RUN rm -Rf docker/ RUN set -eux; \ @@ -101,7 +102,7 @@ RUN rm $PHP_INI_DIR/conf.d/app.prod.ini; \ mv "$PHP_INI_DIR/php.ini" "$PHP_INI_DIR/php.ini-production"; \ mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" -COPY docker/php/conf.d/app.dev.ini $PHP_INI_DIR/conf.d/ +COPY --link docker/php/conf.d/app.dev.ini $PHP_INI_DIR/conf.d/ RUN set -eux; \ install-php-extensions xdebug @@ -122,6 +123,6 @@ FROM caddy:${CADDY_VERSION} AS app_caddy WORKDIR /srv/app -COPY --from=app_caddy_builder /usr/bin/caddy /usr/bin/caddy -COPY --from=app_php /srv/app/public public/ -COPY docker/caddy/Caddyfile /etc/caddy/Caddyfile +COPY --from=app_caddy_builder --link /usr/bin/caddy /usr/bin/caddy +COPY --from=app_php --link /srv/app/public public/ +COPY --link docker/caddy/Caddyfile /etc/caddy/Caddyfile diff --git a/README.md b/README.md index 54563b1..8f5e9d6 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ A [Docker](https://www.docker.com/)-based installer and runtime for the [Symfony ## Getting Started -1. If not already done, [install Docker Compose](https://docs.docker.com/compose/install/) +1. If not already done, [install Docker Compose](https://docs.docker.com/compose/install/) (v2.10+) 2. Run `docker compose build --pull --no-cache` to build fresh images 3. Run `docker compose up` (the logs will be displayed in the current shell) 4. Open `https://localhost` in your favorite web browser and [accept the auto-generated TLS certificate](https://stackoverflow.com/a/15076602/1352334)