add caddy

This commit is contained in:
Jun Kurihara 2022-06-27 22:03:36 -04:00
commit c0af62b6cd
No known key found for this signature in database
GPG key ID: 48ADFD173ED22B03
3 changed files with 70 additions and 1 deletions

47
Dockerfile Normal file
View file

@ -0,0 +1,47 @@
FROM ubuntu:22.04
LABEL maintainer="Jun Kurihara"
SHELL ["/bin/sh", "-x", "-c"]
ENV SERIAL 2
ENV CFLAGS=-Ofast
ENV BUILD_DEPS curl make build-essential libevent-dev libexpat1-dev autoconf file libssl-dev byacc pkg-config
ENV RUNTIME_DEPS bash util-linux coreutils findutils grep libssl3 ldnsutils libevent-2.1 expat ca-certificates jed logrotate
RUN apt-get update; apt-get -qy dist-upgrade; apt-get -qy clean && \
apt-get install -qy --no-install-recommends $RUNTIME_DEPS && \
rm -fr /tmp/* /var/tmp/* /var/cache/apt/* /var/lib/apt/lists/* /var/log/apt/* /var/log/*.log
RUN update-ca-certificates 2> /dev/null || true
WORKDIR /tmp
COPY . /tmp/
ENV RUSTFLAGS "-C link-arg=-s"
RUN apt-get update && apt-get install -qy --no-install-recommends $BUILD_DEPS && \
curl -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain stable && \
export PATH="$HOME/.cargo/bin:$PATH" && \
echo "Building rpxy from source" && \
cargo build --release --no-default-features && \
mkdir -p /opt/rpxy/sbin && \
mv /tmp/target/release/rpxy /opt/rpxy/sbin/ && \
strip --strip-all /opt/rpxy/sbin/rpxy && \
apt-get -qy purge $BUILD_DEPS && apt-get -qy autoremove && \
rm -fr ~/.cargo ~/.rustup && \
rm -fr /tmp/* /var/tmp/* /var/cache/apt/* /var/lib/apt/lists/* /var/log/apt/* /var/log/*.log
rm -fr ~/.cargo ~/.rustup && \
rm -fr /tmp/* /var/tmp/* /var/cache/apt/* /var/lib/apt/lists/* /var/log/apt/* /var/log/*.log
COPY docker-bin/run.sh /
COPY docker-bin/entrypoint.sh /
RUN chmod 755 /run.sh && \
chmod 755 /entrypoint.sh
EXPOSE 53/udp 53/tcp
CMD ["/entrypoint.sh"]
ENTRYPOINT ["/entrypoint.sh"]

10
bench/Caddyfile Normal file
View file

@ -0,0 +1,10 @@
{
auto_https off
}
:80 {
# Proxy everything else to Rocket
reverse_proxy backend-nginx
}

View file

@ -2,11 +2,13 @@ version: "3"
services: services:
nginx: nginx:
image: nginx:alpine image: nginx:alpine
container_name: nginx-web container_name: backend-nginx
restart: unless-stopped restart: unless-stopped
environment: environment:
- VIRTUAL_HOST="127.0.0.1" - VIRTUAL_HOST="127.0.0.1"
- VIRTUAL_PORT=80 - VIRTUAL_PORT=80
expose:
- 80
ports: ports:
- 127.0.0.1:8888:80 - 127.0.0.1:8888:80
logging: logging:
@ -28,3 +30,13 @@ services:
options: options:
max-size: "10m" max-size: "10m"
max-file: "3" max-file: "3"
caddy-rp:
image: caddy:2
container_name: proxy-caddy
ports:
- 127.0.0.1:8100:80
restart: unless-stopped
tty: false
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro