2023-01-10 19:03:30 +00:00
|
|
|
ARG PHP_VERSION=8.2
|
|
|
|
|
2023-12-31 16:03:03 +00:00
|
|
|
# Tree of layers:
|
|
|
|
# base
|
|
|
|
# ├── dev-tools
|
|
|
|
# │ ├── build
|
|
|
|
# │ └── devcontainer
|
|
|
|
# └── run (copies built artifacts out of build)
|
|
|
|
|
|
|
|
# Install base packages
|
|
|
|
# Things which all stages (build, test, run) need
|
2023-06-27 10:27:11 +00:00
|
|
|
FROM debian:bookworm AS base
|
2023-12-30 13:26:19 +00:00
|
|
|
COPY --from=mwader/static-ffmpeg:6.1 /ffmpeg /ffprobe /usr/local/bin/
|
2023-12-24 15:50:54 +00:00
|
|
|
RUN apt update && \
|
|
|
|
apt upgrade -y && \
|
|
|
|
apt install -y curl && \
|
|
|
|
curl --output /usr/share/keyrings/nginx-keyring.gpg https://unit.nginx.org/keys/nginx-keyring.gpg && \
|
|
|
|
echo 'deb [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/debian/ bookworm unit' > /etc/apt/sources.list.d/unit.list && \
|
|
|
|
apt update && apt install -y --no-install-recommends \
|
2024-01-07 18:40:31 +00:00
|
|
|
php${PHP_VERSION}-cli \
|
|
|
|
php${PHP_VERSION}-gd php${PHP_VERSION}-zip php${PHP_VERSION}-xml php${PHP_VERSION}-mbstring php${PHP_VERSION}-curl \
|
|
|
|
php${PHP_VERSION}-pgsql php${PHP_VERSION}-mysql php${PHP_VERSION}-sqlite3 \
|
|
|
|
php${PHP_VERSION}-memcached \
|
2024-06-30 10:28:42 +00:00
|
|
|
curl rsync imagemagick zip unzip unit unit-php && \
|
2023-12-24 15:50:54 +00:00
|
|
|
rm -rf /var/lib/apt/lists/*
|
2023-06-27 10:27:11 +00:00
|
|
|
|
2023-12-31 16:03:03 +00:00
|
|
|
# Install dev packages
|
|
|
|
# Things which are only needed during development - Composer has 100MB of
|
|
|
|
# dependencies, so let's avoid including that in the final image
|
|
|
|
FROM base AS dev-tools
|
2023-12-24 15:50:54 +00:00
|
|
|
RUN apt update && apt upgrade -y && \
|
2023-12-24 18:55:44 +00:00
|
|
|
apt install -y composer php${PHP_VERSION}-xdebug git procps net-tools vim && \
|
2023-12-24 15:50:54 +00:00
|
|
|
rm -rf /var/lib/apt/lists/*
|
2023-12-13 23:51:51 +00:00
|
|
|
ENV XDEBUG_MODE=coverage
|
2023-06-27 10:27:11 +00:00
|
|
|
|
2023-12-31 16:03:03 +00:00
|
|
|
# "Build" shimmie (composer install)
|
|
|
|
# Done in its own stage so that we don't meed to include all the
|
|
|
|
# composer fluff in the final image
|
|
|
|
FROM dev-tools AS build
|
2020-03-22 15:23:23 +00:00
|
|
|
COPY composer.json composer.lock /app/
|
|
|
|
WORKDIR /app
|
2024-01-05 15:59:30 +00:00
|
|
|
RUN composer install --no-dev --no-progress
|
2020-03-25 19:43:28 +00:00
|
|
|
COPY . /app/
|
|
|
|
|
2023-12-13 23:51:51 +00:00
|
|
|
# Devcontainer target
|
2023-12-31 16:03:03 +00:00
|
|
|
# Contains all of the build and debug tools, but no code, since
|
|
|
|
# that's mounted from the host
|
|
|
|
FROM dev-tools AS devcontainer
|
2023-11-07 20:58:46 +00:00
|
|
|
EXPOSE 8000
|
2023-12-13 23:51:51 +00:00
|
|
|
|
2020-03-22 15:23:23 +00:00
|
|
|
# Actually run shimmie
|
2023-11-07 20:58:46 +00:00
|
|
|
FROM base AS run
|
2018-11-07 00:43:01 +00:00
|
|
|
EXPOSE 8000
|
2023-12-24 22:49:50 +00:00
|
|
|
# HEALTHCHECK --interval=1m --timeout=3s CMD curl --fail http://127.0.0.1:8000/ || exit 1
|
2023-12-31 14:45:39 +00:00
|
|
|
ARG BUILD_TIME=unknown BUILD_HASH=unknown
|
2024-02-21 18:42:33 +00:00
|
|
|
ENV UID=1000 GID=1000
|
2023-11-07 20:58:46 +00:00
|
|
|
COPY --from=build /app /app
|
2023-12-23 01:12:48 +00:00
|
|
|
WORKDIR /app
|
2024-01-06 19:32:33 +00:00
|
|
|
RUN echo "_d('BUILD_TIME', '$BUILD_TIME');" >> core/sys_config.php && \
|
|
|
|
echo "_d('BUILD_HASH', '$BUILD_HASH');" >> core/sys_config.php
|
2023-12-16 23:44:46 +00:00
|
|
|
ENTRYPOINT ["/app/.docker/entrypoint.sh"]
|
2024-02-21 18:42:33 +00:00
|
|
|
CMD ["php", "/app/.docker/run.php"]
|