You can also use Google Cloud Run.


Table of Contents


Apache

Listen port: 80

FROM httpd:2.4
COPY ./public_html/ /usr/local/apache2/htdocs/

Caddy v2

Listen port: 80

FROM caddy:alpine
COPY ./public_html/ /usr/share/caddy/

If you use Caddyfile, Add line:

COPY ./Caddyfile /etc/caddy/Caddyfile

Hugo + Caddy v2

Listen port: 80
The latest version of Hugo at the time of build is used.

FROM klakegg/hugo:onbuild AS hugo
FROM caddy:alpine
COPY --from=hugo /target/ /usr/share/caddy/

If you use Caddyfile, Add line:

COPY ./Caddyfile /etc/caddy/Caddyfile

MkDocs + Caddy v2

Listen port: 80

FROM python:3-slim as mkdocs
COPY ./ ./
RUN pip install --no-cache-dir -r requirements.txt
RUN mkdocs build
FROM caddy:alpine
COPY --from=mkdocs ./site/ /usr/share/caddy/

If you use Caddyfile, Add line:

COPY ./Caddyfile /etc/caddy/Caddyfile

Line up the pip packages in requirements.txt:

mkdocs
mkdocs-bootswatch
mkdocs-minify-plugin

PHP Built-in web server

Listen port: 8080

Not recommended for public web

FROM php:8.0-alpine
COPY ./ ./
ENV PHP_CLI_SERVER_WORKERS="16"
CMD ["php", "-S", "0.0.0.0:8080"]

PHP + Apache

Listen port: 8080

FROM php:8.0-apache
COPY ./public_html/ /var/www/html/
RUN sed -i 's/80/8080/g' /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"