fix: refactoring

This commit is contained in:
charlesgauthereau
2026-02-10 19:11:01 +01:00
parent eff7b24b7a
commit 5dfe1b758e
9 changed files with 0 additions and 301 deletions
-28
View File
@@ -17,35 +17,11 @@ RUN apt-get update && apt-get install -y \
nginx \
&& rm -rf /var/lib/apt/lists/*
#FROM base AS tusd-base
#
#ENV TUSD_VERSION=2.8.0
#
#RUN apt-get update && apt-get install -y \
# curl \
# ca-certificates \
# bash \
# tar \
# gzip \
# libssl-dev \
# && rm -rf /var/lib/apt/lists/*
#
## Download and extract tusd
#RUN curl -L -o /tmp/tusd.tar.gz \
# https://github.com/tus/tusd/releases/download/v${TUSD_VERSION}/tusd_linux_amd64.tar.gz \
# && mkdir -p /usr/local/bin \
# && tar -xzf /tmp/tusd.tar.gz -C /tmp \
# # Move the actual binary, whatever its name/folder inside tar
# && mv /tmp/*/tusd /usr/local/bin/tusd \
# && chmod +x /usr/local/bin/tusd \
# && /usr/local/bin/tusd --version
# Use Debian-based Go for reliable networking/DNS during build
FROM --platform=$BUILDPLATFORM golang:1.23-bookworm AS tusd-base
ARG TUSD_VERSION=2.8.0
# Install git
RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
@@ -54,16 +30,13 @@ WORKDIR /build
RUN git clone https://github.com/tus/tusd.git . \
&& git checkout v${TUSD_VERSION}
# Build statically linked binary
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \
go build -ldflags="-s -w" -o /tusddist/tusd ./cmd/tusd
# Minimal dist stage (scratch keeps final image small)
FROM scratch AS tusd-dist
COPY --from=tusd-base /tusddist/tusd /tusd
FROM base AS build-env
RUN corepack enable && corepack prepare pnpm@latest --activate
@@ -116,7 +89,6 @@ COPY --from=builder --chown=1001:1001 /app/.next/static ./.next/static
COPY --chown=1001:1001 src/db ./src/db
COPY --from=deps /app/node_modules ./node_modules
#COPY --from=tusd-base /usr/local/bin/tusd /usr/local/bin/tusd
COPY --from=tusd-dist /tusd /usr/local/bin/tusd
RUN chmod +x /usr/local/bin/tusd
@@ -9,11 +9,6 @@ fi
mkdir -p /app/private/uploads/tmp
echo "▶ Starting tusd server..."
#tusd --dir /app/private/uploads/tmp --hooks-http http://localhost:80/api/tus/hooks --port 1080 &
#tusd --upload-dir /app/private/uploads/tmp --hooks-http http://localhost:3000/api/tus/hooks --port 1080 --max-size 21474836480 &
#tusd --base-path /tus --upload-dir /app/private/uploads/tmp --hooks-http http://127.0.0.1:3000/api/tus/hooks --port 1080 --max-size 21474836480 --hooks-http-forward-headers "*" &
#tusd --upload-dir /app/private/uploads/tmp --hooks-http http://127.0.0.1:3000/api/tus/hooks --port 1080 --max-size 21474836480 --hooks-http-forward-headers "X-Generated-Id" &
#tusd --upload-dir /app/private/uploads/tmp --hooks-http http://127.0.0.1:3000/api/tus/hooks --port 1080 --max-size 21474836480 --behind-proxy true --hooks-http-forward-headers "X-Generated-Id" &
tusd --base-path /tus/files/ --upload-dir /app/private/uploads/tmp --hooks-http http://127.0.0.1:3000/api/tus/hooks --port 1080 --max-size 21474836480 &
echo "▶ Starting Next.js server..."
@@ -23,5 +18,3 @@ echo "▶ Starting nginx..."
exec nginx -g "daemon off;"
#exec "$@"
-24
View File
@@ -7,48 +7,24 @@ http {
server {
listen 80;
# TUS uploads zero buffering
# location /tus/ {
# proxy_pass http://127.0.0.1:1080/;
# # proxy_request_buffering off;
# # proxy_buffering off;
# # proxy_http_version 1.1;
location /tus/ {
# rewrite ^/tus/(.*)$ /$1 break;
# proxy_pass http://127.0.0.1:1080/;
# proxy_request_buffering off;
# proxy_buffering off;
# proxy_http_version 1.1;
proxy_pass http://127.0.0.1:1080/tus/;
proxy_pass_request_headers on;
# proxy_set_header Host $host;
# proxy_set_header X-Forwarded-Host $host;
# proxy_set_header X-Forwarded-Proto $scheme;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Disable request and response buffering
proxy_request_buffering off;
proxy_buffering off;
proxy_http_version 1.1;
# Add X-Forwarded-* headers
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Host $host:$server_port;
# proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# # proxy_set_header Connection "";
client_max_body_size 0;
}
# Next.js
location / {
proxy_pass http://127.0.0.1:3000;