Files
Jump/Dockerfile

75 lines
2.0 KiB
Docker
Raw Permalink Normal View History

# This dockerfile is intended to built using buildx to enable multi-platform
# images...
# https://docs.docker.com/desktop/multi-arch/
# docker buildx create --name mybuilder
# docker buildx use mybuilder
# docker buildx inspect --bootstrap
# docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t daledavies/jump:v1.1.3 --push .
2022-02-04 09:53:55 +00:00
# Start with the official composer image, copy application files and install
# dependencies.
2022-03-19 21:42:57 +00:00
FROM --platform=$BUILDPLATFORM composer AS builder
2022-02-04 10:47:59 +00:00
COPY jumpapp/ /app
2022-02-04 09:53:55 +00:00
RUN composer install --no-dev \
--optimize-autoloader \
--no-interaction \
--no-progress
2022-03-17 11:24:14 +00:00
# Switch to base alpine image so we can copy application files into it.
FROM alpine:latest
2022-02-04 09:53:55 +00:00
WORKDIR /var/www/html
2022-02-04 09:53:55 +00:00
# Create a non-root user for running nginx and php.
RUN addgroup -S jumpapp && \
adduser \
--disabled-password \
--ingroup jumpapp \
--no-create-home \
jumpapp
2022-02-04 09:53:55 +00:00
# Copy the built files from composer, chowning as jumpapp or they will
# be owned by root.
COPY --chown=jumpapp --from=builder /app /usr/src/jumpapp
# Install required packages.
RUN apk add --no-cache \
bash \
curl \
nginx \
2023-03-01 14:56:45 +00:00
php81 \
php81-curl \
php81-dom \
php81-fileinfo \
php81-fpm \
php81-json \
php81-opcache \
php81-openssl \
php81-session \
php81-xml \
php81-zlib
# Create symlink for anything expecting to use "php".
RUN ln -s -f /usr/bin/php81 /usr/bin/php
# Nginx config.
COPY docker/nginx.conf /etc/nginx/nginx.conf
# PHP/FPM config.
2023-03-01 14:56:45 +00:00
COPY docker/fpm-pool.conf /etc/php81/php-fpm.d/www.conf
COPY docker/php.ini /etc/php81/conf.d/custom.ini
COPY docker/entrypoint.sh /usr/local/bin/
# Create the cache directories and change owner of everything we need.
RUN mkdir /var/www/cache \
&& chown -R jumpapp:jumpapp /var/www/html /var/www/cache \
&& chmod +x /usr/local/bin/entrypoint.sh
# Expose the port we configured for nginx.
EXPOSE 8080
2022-02-04 09:53:55 +00:00
ENTRYPOINT ["entrypoint.sh"]
2022-03-17 10:34:25 +00:00
HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:8080/fpm-ping || exit 1