fix: build ask binary inside Docker for Linux x86_64

This commit is contained in:
2026-03-28 15:09:17 +01:00
parent 36eb480687
commit 0c1f09529a
2 changed files with 52 additions and 47 deletions

View File

@@ -1,51 +1,50 @@
http://ask.xn--2dk.xyz { :8080 {
handle / { # Route based on Host header (set by haloy)
@ask {
host ask.xn--2dk.xyz
}
@db {
host db.xn--2dk.xyz
}
handle @ask {
reverse_proxy localhost:7682 { reverse_proxy localhost:7682 {
flush_interval -1 flush_interval -1
} }
} }
}
https://ask.xn--2dk.xyz { handle @db {
tls admin@xn--2dk.xyz handle /health {
handle / { respond 200
reverse_proxy localhost:7682 { }
flush_interval -1
} handle /login {
} reverse_proxy 127.0.0.1:8081
} }
https://db.xn--2dk.xyz { handle /query {
handle /health { reverse_proxy 127.0.0.1:8081
respond 200 }
}
@websocket {
handle /login { header Connection *Upgrade*
reverse_proxy 127.0.0.1:8081 header Upgrade websocket
} }
handle /query { handle @websocket {
reverse_proxy 127.0.0.1:8081 reverse_proxy localhost:7681 {
} flush_interval -1
}
@websocket { }
header Connection *Upgrade*
header Upgrade websocket handle {
} forward_auth 127.0.0.1:8081 {
uri /auth
handle @websocket { copy_headers Cookie
reverse_proxy localhost:7681 { }
flush_interval -1 reverse_proxy localhost:7681 {
} flush_interval -1
} }
handle {
forward_auth 127.0.0.1:8081 {
uri /auth
copy_headers Cookie
}
reverse_proxy localhost:7681 {
flush_interval -1
} }
} }
} }

View File

@@ -3,7 +3,7 @@ FROM debian:12-slim
RUN apt-get update -qq && \ RUN apt-get update -qq && \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
curl ca-certificates unzip bsdmainutils python3 \ curl ca-certificates unzip bsdmainutils python3 \
less ncurses-bin && \ less ncurses-bin build-essential pkg-config libssl-dev && \
curl -fsSL \ curl -fsSL \
"https://github.com/caddyserver/caddy/releases/download/v2.9.1/caddy_2.9.1_linux_amd64.tar.gz" \ "https://github.com/caddyserver/caddy/releases/download/v2.9.1/caddy_2.9.1_linux_amd64.tar.gz" \
| tar -xz -C /usr/local/bin caddy && \ | tar -xz -C /usr/local/bin caddy && \
@@ -14,19 +14,25 @@ RUN apt-get update -qq && \
unzip /tmp/duckdb.zip -d /usr/local/bin && \ unzip /tmp/duckdb.zip -d /usr/local/bin && \
chmod +x /usr/local/bin/duckdb && \ chmod +x /usr/local/bin/duckdb && \
rm /tmp/duckdb.zip && \ rm /tmp/duckdb.zip && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
duckdb :memory: "INSTALL httpfs;" && \ duckdb :memory: "INSTALL httpfs;" && \
curl -fsSL "https://github.com/tsl0922/ttyd/releases/latest/download/ttyd.x86_64" \ curl -fsSL "https://github.com/tsl0922/ttyd/releases/latest/download/ttyd.x86_64" \
-o /usr/local/bin/ttyd && \ -o /usr/local/bin/ttyd && \
chmod +x /usr/local/bin/ttyd chmod +x /usr/local/bin/ttyd
ENV LANG=C.UTF-8 \ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
apt-get clean && rm -rf /var/lib/apt/lists/*
ENV PATH="/root/.cargo/bin:${PATH}" \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 LC_ALL=C.UTF-8
WORKDIR /app WORKDIR /app
COPY basedosdados.duckdb Caddyfile start.sh auth.py ./ COPY basedosdados.duckdb Caddyfile start.sh auth.py ./
COPY ask/target/release/ask /app/ask COPY ask/ ./ask/
RUN cd ask && ~/.cargo/bin/cargo build --release && \
mv target/release/ask /app/ask && \
rm -rf target
RUN chmod +x start.sh /app/ask RUN chmod +x start.sh /app/ask
EXPOSE 8080 EXPOSE 8080