ยง2023-12-16

FROM debian:bookworm

USER root

RUN echo 'root:b23258585' | chpasswd
RUN useradd -m -d /home/alexlai -s /bin/bash -G sudo -u 1026 alexlai && \
    echo 'alexlai:alex1765' | chpasswd

# 
RUN apt update && apt -y upgrade && \
    apt install -y fonts-noto-cjk caddy
#
USER alexlai
RUN mkdir /home/alexlai/yushei-caddy-markdown
#
USER root
WORKDIR /home/alexlai/yushei-caddy-markdown
#
EXPOSE 80
EXPOSE 443
EXPOSE 443/udp
EXPOSE 2019

# Make sure it runs and reports its version
RUN ["caddy", "version"]

# CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
CMD ["caddy", "run"]

LABEL maintainer="alexlai@munetaka.me"

#
# Notes
#
# docker build --tag caddy:debian_bookworm (--no-cache) ./
# docker run -it  caddy:debian_bookworm /bin/bash
# Testing 
# docker run -d -p 42103:80 --name Debian_caddy caddy:debian_bookworm 
# sudo docker run -d -p 42103:80 -v /volume2/YuSheiCaddyMarkdown/Caddyfile:/etc/caddy/Caddyfile -v /volume2/YuSheiCaddyMarkdown:/home/alexlai/yushei-caddy-markdown --name Debian_caddy caddy:debian_bookworm
# docker run -d -p 42103:80 --mount type=bind,source=/volume1/JupyterHub,target=/home/alexlai/JupyterHub --name jupyterhub jupyterhub:ubuntu_conda jupyterhub
#                       outside-port:inside-port
# docker run -d -p 42100:8000  --name jupyterhub jupyterhub:ubuntu_conda jupyterhub
#
# docker ps
# docker stop (NAMES)
# docker rm  (NAMES)
#

caddy_no_Caddyfile.png caddy_no_Caddyfile-01.png caddy_no_Caddyfile-02.png caddy_no_Caddyfile-03.png caddy_no_Caddyfile-04.png caddy_no_Caddyfile-05.png caddy_no_Caddyfile-06.png

curl 192.168.2.251:42019/load
-H "Content-Type: application/json"
-d @- << EOF { "apps": { "http": { "servers": { "hello": { "listen": [":80"], "routes": [ { "handle": [{ "handler": "static_response", "body": "Hello, world!" }] } ] } } } } } EOF