ARG DENO_VERSION=2.9.5 ARG YT_DLP_VERSION=2026.08.19 FROM denoland/deno:bin-${DENO_VERSION} AS deno_cache # YT-DLP Download and setup FROM --platform=$BUILDPLATFORM golang:bookworm AS ytdlp_cache ARG TARGETOS ARG TARGETARCH ARG YT_DLP_VERSION ARG YT_DLP_SHA256=1fa6733c37ea6fb51c99ad8fe785e7b7e5f3246c9b980230329d4fb72ed8d4d6 RUN apt update && apt install -y wget RUN wget "https://github.com/yt-dlp/yt-dlp/releases/download/${YT_DLP_VERSION}/yt-dlp" -O /usr/local/bin/yt-dlp \ && echo "${YT_DLP_SHA256} /usr/local/bin/yt-dlp" | sha256sum -c - RUN chmod a+rx /usr/local/bin/yt-dlp # Backend setup FROM devopsworks/golang-upx:latest as backend-builder ENV DEBIAN_FRONTEND noninteractive WORKDIR /app COPY ./backend /app RUN go mod tidy RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o whishper . && \ upx whishper RUN chmod a+rx whishper # Frontend setup FROM node:alpine as frontend ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" RUN npm install --global pnpm@8.15.9 COPY ./frontend /app WORKDIR /app FROM frontend AS frontend-prod-deps RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile FROM frontend AS frontend-build RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile ENV BODY_SIZE_LIMIT=0 RUN pnpm run build # Base container FROM python:3.11-slim as base RUN export DEBIAN_FRONTEND=noninteractive \ && apt-get -qq update \ && apt-get -qq install --no-install-recommends \ ffmpeg curl nodejs nginx supervisor \ && rm -rf /var/lib/apt/lists/* # Python service setup COPY ./transcription-api /app/transcription WORKDIR /app/transcription RUN pip3 install -r requirements.txt RUN pip3 install python-multipart # Node.js service setup ENV BODY_SIZE_LIMIT=0 COPY ./frontend /app/frontend COPY --from=frontend-build /app/build /app/frontend COPY --from=frontend-prod-deps /app/node_modules /app/frontend/node_modules # Golang service setup COPY --from=backend-builder /app/whishper /bin/whishper RUN chmod a+rx /bin/whishper COPY --from=ytdlp_cache /usr/local/bin/yt-dlp /bin/yt-dlp COPY --from=deno_cache /deno /bin/deno # Nginx setup COPY ./nginx.conf /etc/nginx/nginx.conf # Set workdir and entrypoint WORKDIR /app RUN mkdir /app/uploads # Cleanup to make the image smaller RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* ~/.cache /var/cache COPY ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf ENTRYPOINT ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] # Expose ports for each service and Nginx EXPOSE 8080 3000 5000 80