forked from daveroverts/bmac
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
55 lines (42 loc) · 1.89 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
# Intermediate build container for front-end resources
FROM docker.io/library/node:18-alpine as frontend
# Easy to prune intermediary containers
LABEL stage=build
WORKDIR /app
COPY ./ /app/
RUN npm ci && \
npm run build
####################################################################################################
# Primary container
FROM docker.io/library/php:8.1-apache-bullseye
# Default container port for the apache configuration
EXPOSE 80 443
# Install various dependencies
# - git and unzip for composer
# - vim and nano for our egos
# - ca-certificates for OAuth2
RUN apt-get update && \
apt-get install -y git unzip vim nano ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
a2enmod rewrite ssl remoteip
# Custom Apache2 configuration based on defaults; fairly straightforward
COPY ./container/configs/000-default.conf /etc/apache2/sites-available/000-default.conf
COPY ./container/configs/apache.conf /etc/apache2/apache2.conf
# Custom PHP configuration based on $PHP_INI_DIR/php.ini-production
COPY ./container/configs/php.ini /usr/local/etc/php/php.ini
# Install PHP extension(s)
COPY --from=mlocati/php-extension-installer:2.1.38 /usr/bin/install-php-extensions /usr/local/bin/
RUN install-php-extensions pdo_mysql bcmath zip gd pcntl
# Install composer
COPY --from=docker.io/library/composer:latest /usr/bin/composer /usr/bin/composer
# Copy over the application, static files, plus the ones built/transpiled by Mix in the frontend stage further up
COPY --chown=www-data:www-data ./ /app/
COPY --from=frontend --chown=www-data:www-data /app/public/ /app/public/
WORKDIR /app
RUN composer install --no-dev --no-interaction --prefer-dist
RUN mkdir -p /app/storage/logs/
# Wrap around the default PHP entrypoint with a custom entrypoint
COPY ./container/entrypoint.sh /usr/local/bin/service-entrypoint
ENTRYPOINT [ "service-entrypoint" ]
CMD ["apache2-foreground"]