Update Dockerfile
Browse files- Dockerfile +11 -18
Dockerfile
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
FROM node:21.0-alpine AS deps
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
#
|
| 6 |
RUN apk add --no-cache libc6-compat
|
| 7 |
|
| 8 |
COPY package.json yarn.lock ./
|
|
@@ -16,15 +16,20 @@ COPY --from=deps /app/node_modules ./node_modules
|
|
| 16 |
COPY . .
|
| 17 |
RUN yarn build
|
| 18 |
|
| 19 |
-
# Production image, copy all the files and run
|
| 20 |
FROM node:21.0-alpine AS runner
|
| 21 |
WORKDIR /app
|
| 22 |
|
|
|
|
| 23 |
ENV SITE_NAME="Web-SyncPlay"
|
|
|
|
| 24 |
ENV PUBLIC_DOMAIN="https://web-syncplay.de"
|
|
|
|
| 25 |
ENV REDIS_URL="redis://redis:6379"
|
| 26 |
|
| 27 |
-
|
|
|
|
|
|
|
| 28 |
|
| 29 |
LABEL org.opencontainers.image.url="https://web-syncplay.de" \
|
| 30 |
org.opencontainers.image.description="Watch videos or play music in sync with your friends" \
|
|
@@ -37,25 +42,13 @@ RUN addgroup -g 1001 -S nodejs && \
|
|
| 37 |
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp && \
|
| 38 |
chmod a+rx /usr/local/bin/yt-dlp
|
| 39 |
|
| 40 |
-
#
|
| 41 |
-
# COPY --from=builder /app/next.config.js ./
|
| 42 |
COPY --from=builder /app/public ./public
|
| 43 |
COPY --from=builder /app/package.json ./package.json
|
| 44 |
-
|
| 45 |
-
# Automatically leverage output traces to reduce image size
|
| 46 |
-
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
| 47 |
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
| 48 |
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
| 49 |
|
| 50 |
USER nextjs
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
ENV PORT 8081
|
| 55 |
-
|
| 56 |
-
# Next.js collects completely anonymous telemetry data about general usage.
|
| 57 |
-
# Learn more here: https://nextjs.org/telemetry
|
| 58 |
-
# Uncomment the following line in case you want to disable telemetry.
|
| 59 |
-
# ENV NEXT_TELEMETRY_DISABLED 1
|
| 60 |
-
|
| 61 |
-
CMD ["sh", "-c", "node server.js"]
|
|
|
|
| 2 |
FROM node:21.0-alpine AS deps
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# libc6-compat helps some native deps
|
| 6 |
RUN apk add --no-cache libc6-compat
|
| 7 |
|
| 8 |
COPY package.json yarn.lock ./
|
|
|
|
| 16 |
COPY . .
|
| 17 |
RUN yarn build
|
| 18 |
|
| 19 |
+
# Production image, copy all the files and run Next.js
|
| 20 |
FROM node:21.0-alpine AS runner
|
| 21 |
WORKDIR /app
|
| 22 |
|
| 23 |
+
# Default envs (override in Space settings)
|
| 24 |
ENV SITE_NAME="Web-SyncPlay"
|
| 25 |
+
# Set this in Space settings to your Space URL, e.g. https://your-username-web-syncplay.hf.space
|
| 26 |
ENV PUBLIC_DOMAIN="https://web-syncplay.de"
|
| 27 |
+
# Use a managed Redis URL (e.g. Upstash) set in Space settings
|
| 28 |
ENV REDIS_URL="redis://redis:6379"
|
| 29 |
|
| 30 |
+
# Hugging Face Spaces expects your app to listen on $PORT (default 7860)
|
| 31 |
+
ENV PORT=7860
|
| 32 |
+
EXPOSE 7860
|
| 33 |
|
| 34 |
LABEL org.opencontainers.image.url="https://web-syncplay.de" \
|
| 35 |
org.opencontainers.image.description="Watch videos or play music in sync with your friends" \
|
|
|
|
| 42 |
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp && \
|
| 43 |
chmod a+rx /usr/local/bin/yt-dlp
|
| 44 |
|
| 45 |
+
# Static assets and standalone output
|
|
|
|
| 46 |
COPY --from=builder /app/public ./public
|
| 47 |
COPY --from=builder /app/package.json ./package.json
|
|
|
|
|
|
|
|
|
|
| 48 |
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
| 49 |
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
| 50 |
|
| 51 |
USER nextjs
|
| 52 |
|
| 53 |
+
# Next.js will pick up PORT env var
|
| 54 |
+
CMD ["sh", "-c", "node server.js"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|