Docker-Swarm-Loadbalancer/bouncer/Dockerfile

80 lines
2.6 KiB
Text
Raw Normal View History

FROM benzine/php:cli-8.1 as bouncer
2024-01-25 10:41:42 +00:00
ARG BUILD_DATE
2024-01-05 17:15:51 +00:00
ARG GIT_SHA
2024-01-25 10:41:42 +00:00
ENV BUILD_DATE=${BUILD_DATE} \
GIT_SHA=${GIT_SHA}
LABEL maintainer="Matthew Baggett <matthew@baggett.me>" \
2021-06-06 22:08:12 +00:00
org.label-schema.vcs-url="https://github.com/benzine-framework/docker" \
org.opencontainers.image.source="https://github.com/benzine-framework/docker"
# Install nginx, certbot
RUN apt-get -qq update && \
# Install pre-dependencies to use apt-key.
apt-get -yqq install --no-install-recommends \
lsb-core \
gnupg \
&& \
# Add nginx ppa
sh -c 'echo "deb http://ppa.launchpad.net/nginx/stable/ubuntu $(lsb_release -sc) main" \
> /etc/apt/sources.list.d/nginx-stable.list' && \
# Add nginx key
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C300EE8C && \
2023-01-09 14:57:00 +00:00
# Update
apt-get -qq update && \
2023-01-09 14:57:00 +00:00
# Install Nginx, Certbot bits and apache2-utils for htpasswd generation
apt-get -yqq install --no-install-recommends \
nginx \
2022-05-05 10:38:19 +00:00
python3-certbot-nginx \
2023-01-09 14:57:00 +00:00
apache2-utils \
&& \
2023-01-09 14:57:00 +00:00
# Cleanup
apt-get remove -yqq \
lsb-core \
cups-common \
&& \
apt-get autoremove -yqq && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/lib/dpkg/status.old /var/cache/debconf/templates.dat /var/log/dpkg.log /var/log/lastlog /var/log/apt/*.log
2024-01-25 13:01:25 +00:00
COPY self-signed-certificates /certs
COPY nginx.runit /etc/service/nginx/run
COPY logs.runit /etc/service/nginx-logs/run
COPY bouncer.runit /etc/service/bouncer/run
2024-01-25 13:01:25 +00:00
COPY bouncer.finish /etc/service/bouncer/finish
COPY logs-nginx-access.runit /etc/service/logs-nginx-access/run
COPY logs-nginx-error.runit /etc/service/logs-nginx-error/run
2024-01-25 13:01:25 +00:00
RUN chmod +x /etc/service/*/run /etc/service/*/finish
2024-01-08 00:35:15 +00:00
COPY NginxDefault /etc/nginx/sites-enabled/default.conf
COPY Nginx-tweak.conf /etc/nginx/conf.d/tweak.conf
# Disable daemonising in nginx
2024-01-08 00:35:15 +00:00
RUN sed -i '1s;^;daemon off\;\n;' /etc/nginx/nginx.conf && \
sed -i 's|include /etc/nginx/sites-enabled/*|include /etc/nginx/sites-enabled/*.conf|g' /etc/nginx/nginx.conf && \
rm /etc/nginx/sites-enabled/default && \
rm -R /etc/nginx/sites-available
2024-01-25 13:01:25 +00:00
2024-01-05 17:15:51 +00:00
COPY vendor /app/vendor
COPY composer.* /app/
2024-01-25 13:01:25 +00:00
RUN composer install
COPY public /app/public
2024-01-25 13:01:25 +00:00
COPY bin /app/bin
COPY src /app/src
COPY templates /app/templates
VOLUME /etc/letsencrypt
VOLUME /var/log/bouncer
RUN chmod +x /app/bin/bouncer && \
2024-01-08 00:35:15 +00:00
mkdir -p /var/log/bouncer
2022-05-05 14:42:53 +00:00
FROM benzine/php:nginx-8.1 as test-app-a
2022-05-05 14:42:53 +00:00
COPY ./test/public-web-a /app/public
FROM benzine/php:nginx-8.1 as test-app-b
2022-05-05 14:42:53 +00:00
COPY ./test/public-web-b /app/public
2023-01-09 14:57:00 +00:00
FROM benzine/php:nginx-8.1 as test-app-c
COPY ./test/public-web-c /app/public