From 0f297e97140b997c5b1334c8ff05ed2ccdf3e441 Mon Sep 17 00:00:00 2001 From: Roberto Alsina Date: Sat, 29 Jun 2024 20:25:42 -0300 Subject: [PATCH] Tinyproxy + faaso-daemon docker image using multirun --- Dockerfile | 21 +++++++++++++++++++++ shard.lock | 16 ++++++++++++++++ shard.yml | 6 +++++- tinyproxy/tinyproxy.conf | 2 +- 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1bfe5f0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as build +RUN apk add crystal shards yaml-dev openssl-dev zlib-dev +RUN addgroup -S app && adduser app -S -G app +WORKDIR /home/app +COPY shard.yml ./ +RUN mkdir src/ +COPY src/* src/ +RUN shards install +RUN shards build + +FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as ship +RUN apk add tinyproxy multirun openssl zlib yaml pcre2 gc libevent libgcc + +# Unprivileged user +RUN addgroup -S app && adduser app -S -G app +WORKDIR /home/app + +COPY tinyproxy/tinyproxy.conf ./ +COPY --from=build /home/app/bin/faaso-daemon ./ + +CMD ["/usr/bin/multirun", "./faaso-daemon", "tinyproxy -d -c tinyproxy.conf"] \ No newline at end of file diff --git a/shard.lock b/shard.lock index 63b4f90..6b250f5 100644 --- a/shard.lock +++ b/shard.lock @@ -1,5 +1,9 @@ version: 2.0 shards: + backtracer: + git: https://github.com/sija/backtracer.cr.git + version: 1.2.2 + commander: git: https://github.com/mrrooijen/commander.git version: 0.4.0 @@ -12,7 +16,19 @@ shards: git: https://github.com/ralsina/docr.git version: 0.1.1+git.commit.18f15cc7111b1d0c63347c7cca07aee9ec87a7a8 + exception_page: + git: https://github.com/crystal-loot/exception_page.git + version: 0.4.1 + + kemal: + git: https://github.com/kemalcr/kemal.git + version: 1.5.0 + kiwi: git: https://github.com/ralsina/kiwi.git version: 0.1.0+git.commit.65059b87771238593a28b2b8b9fdf77d8e2b9e89 + radix: + git: https://github.com/luislavena/radix.git + version: 0.4.1 + diff --git a/shard.yml b/shard.yml index 14c8e97..6ca2c29 100644 --- a/shard.yml +++ b/shard.yml @@ -7,6 +7,8 @@ authors: targets: faaso: main: src/main.cr + faaso-daemon: + main: src/daemon.cr crystal: '>= 1.12.2' @@ -21,4 +23,6 @@ dependencies: github: mrrooijen/commander kiwi: github: ralsina/kiwi - branch: master \ No newline at end of file + branch: master + kemal: + github: kemalcr/kemal \ No newline at end of file diff --git a/tinyproxy/tinyproxy.conf b/tinyproxy/tinyproxy.conf index 6bed1e4..7b18bde 100644 --- a/tinyproxy/tinyproxy.conf +++ b/tinyproxy/tinyproxy.conf @@ -3,5 +3,5 @@ Listen 0.0.0.0 Timeout 600 Allow 0.0.0.0/0 ReverseOnly Yes -ReversePath "/faaso/hello" "http://localhost:32783" +ReversePath "/faaso/hello/" "http://hello:3000/" ReverseMagic Yes