-
Notifications
You must be signed in to change notification settings - Fork 36
/
Dockerfile
74 lines (60 loc) · 1.97 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# 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 .
# Start with the official composer image, copy application files and install
# dependencies.
FROM --platform=$BUILDPLATFORM composer AS builder
COPY jumpapp/ /app
RUN composer install --no-dev \
--optimize-autoloader \
--no-interaction \
--no-progress
# Switch to base alpine image so we can copy application files into it.
FROM alpine:latest
WORKDIR /var/www/html
# Create a non-root user for running nginx and php.
RUN addgroup -S jumpapp && \
adduser \
--disabled-password \
--ingroup jumpapp \
--no-create-home \
jumpapp
# 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 \
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.
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
ENTRYPOINT ["entrypoint.sh"]
HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:8080/fpm-ping || exit 1