fix: nginx configration

This commit is contained in:
charlesgauthereau
2026-02-09 23:39:14 +01:00
parent c328620f3d
commit eff7b24b7a
5 changed files with 147 additions and 150 deletions
+53 -133
View File
@@ -1,115 +1,5 @@
#FROM node:22-alpine AS base
#
#RUN apk add --update --no-cache \
# libc6-compat \
# openssl \
# tzdata
#
#FROM base AS tusd-base
#
#RUN apk add --no-cache curl ca-certificates bash \
# && TUSD_VERSION=1.28.0 \
# && curl -L -o /usr/local/bin/tusd https://github.com/tus/tusd/releases/download/v${TUSD_VERSION}/tusd-${TUSD_VERSION}-linux-amd64 \
# && chmod +x /usr/local/bin/tusd
#
#
#FROM base AS build-env
#
#RUN apk add --update --no-cache \
# build-base \
# g++ \
# make \
# libtool \
# autoconf \
# automake
#
#RUN corepack enable && corepack prepare pnpm@latest --activate
#
#
#FROM build-env AS deps
#
#WORKDIR /app
#
#COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
#
#RUN pnpm i --frozen-lockfile
#
#
#
#
#FROM build-env AS dev
#
#COPY --from=tusd-base /usr/local/bin/tusd /usr/local/bin/tusd
#
#
#WORKDIR /app
#
#COPY --from=deps /app/node_modules ./node_modules
#COPY . .
#
#USER root
#
#RUN chmod +x /app/docker/entrypoints/app-dev-entrypoint.sh
#ENTRYPOINT ["sh","/app/docker/entrypoints/app-dev-entrypoint.sh"]
#
#
#FROM build-env AS builder
#
#WORKDIR /app
#COPY --from=deps /app/node_modules ./node_modules
#COPY . .
#
#ENV NEXT_TELEMETRY_DISABLED=1
#
#RUN pnpm run build
#
#
#FROM base AS prod
#
#COPY --from=tusd-base /usr/local/bin/tusd /usr/local/bin/tusd
#
#WORKDIR /app
#
#ENV NODE_ENV=production
#ENV NEXT_TELEMETRY_DISABLED=1
#
#RUN addgroup --system --gid 1001 nodejs
#RUN adduser --system --uid 1001 nextjs
#
#COPY --from=builder /app/public ./public
#
#RUN mkdir .next
#RUN chown nextjs:nodejs .next
#RUN mkdir -p /app/private/uploads
#RUN chown -R nextjs:nodejs /app/private
#RUN chown -R nextjs:nodejs /app/public
#
#COPY --from=builder /app/next.config.ts ./
#
#COPY --from=builder /app/portabase.config.ts ./
#COPY --from=builder /app/drizzle.config.ts ./
#COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
#COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
#COPY --chown=nextjs:nodejs src/db ./src/db
#
#USER root
#
#COPY ./docker/entrypoints/app-prod-entrypoint.sh /app/app-prod-entrypoint.sh
#RUN chmod +x /app/app-prod-entrypoint.sh
#
#EXPOSE 80
#
#ENV PORT=80
#
#ENV HOSTNAME="0.0.0.0"
#
#USER nextjs
#
#ENTRYPOINT ["sh","/app/app-prod-entrypoint.sh"]
FROM node:22-bullseye AS base
#FROM node:22-bullseye AS base
FROM --platform=$BUILDPLATFORM node:22-bullseye AS base
RUN apt-get update && apt-get install -y \
curl \
@@ -124,30 +14,55 @@ RUN apt-get update && apt-get install -y \
automake \
libtool \
git \
nginx \
&& rm -rf /var/lib/apt/lists/*
FROM base AS tusd-base
#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
ENV TUSD_VERSION=2.8.0
# 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/*
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
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
FROM base AS build-env
@@ -201,7 +116,12 @@ 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-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
COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf
RUN mkdir -p .next /app/private/uploads \
&& chown -R nextjs:nodejs .next /app/private /app/public
@@ -211,5 +131,5 @@ COPY ./docker/entrypoints/app-prod-entrypoint.sh /app/app-prod-entrypoint.sh
RUN chmod +x /app/app-prod-entrypoint.sh
EXPOSE 80
USER nextjs
#USER nextjs
ENTRYPOINT ["sh","/app/app-prod-entrypoint.sh"]