feat: improve Dockerfile link on copy

This commit is contained in:
Maxime Hélias 2022-10-17 11:17:15 +02:00 committed by Maxime Helias
parent 54b9706fe0
commit d600f7ef63
3 changed files with 16 additions and 15 deletions
.github/workflows
DockerfileREADME.md

@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Pull images - name: Pull images
run: docker compose pull run: docker compose pull
- name: Start services - name: Start services

@ -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/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage
# https://docs.docker.com/compose/compose-file/#target # https://docs.docker.com/compose/compose-file/#target
# https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact # https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
ARG PHP_VERSION=8.1 ARG PHP_VERSION=8.1
ARG CADDY_VERSION=2 ARG CADDY_VERSION=2
@ -47,18 +48,18 @@ RUN set -eux; \
###< recipes ### ###< recipes ###
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" 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 --link 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.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 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 RUN chmod +x /usr/local/bin/docker-healthcheck
HEALTHCHECK --interval=10s --timeout=3s --retries=3 CMD ["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 RUN chmod +x /usr/local/bin/docker-entrypoint
ENTRYPOINT ["docker-entrypoint"] ENTRYPOINT ["docker-entrypoint"]
@ -68,7 +69,7 @@ CMD ["php-fpm"]
ENV COMPOSER_ALLOW_SUPERUSER=1 ENV COMPOSER_ALLOW_SUPERUSER=1
ENV PATH="${PATH}:/root/.composer/vendor/bin" 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 # prevent the reinstallation of vendors at every changes in the source code
COPY composer.* symfony.* ./ COPY composer.* symfony.* ./
@ -79,7 +80,7 @@ RUN set -eux; \
fi fi
# copy sources # copy sources
COPY . . COPY --link . .
RUN rm -Rf docker/ RUN rm -Rf docker/
RUN set -eux; \ 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" "$PHP_INI_DIR/php.ini-production"; \
mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" 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; \ RUN set -eux; \
install-php-extensions xdebug install-php-extensions xdebug
@ -122,6 +123,6 @@ FROM caddy:${CADDY_VERSION} AS app_caddy
WORKDIR /srv/app WORKDIR /srv/app
COPY --from=app_caddy_builder /usr/bin/caddy /usr/bin/caddy COPY --from=app_caddy_builder --link /usr/bin/caddy /usr/bin/caddy
COPY --from=app_php /srv/app/public public/ COPY --from=app_php --link /srv/app/public public/
COPY docker/caddy/Caddyfile /etc/caddy/Caddyfile COPY --link docker/caddy/Caddyfile /etc/caddy/Caddyfile

@ -6,7 +6,7 @@ A [Docker](https://www.docker.com/)-based installer and runtime for the [Symfony
## Getting Started ## 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 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) 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) 4. Open `https://localhost` in your favorite web browser and [accept the auto-generated TLS certificate](https://stackoverflow.com/a/15076602/1352334)