implement cookie check, use browser NPM package for auto install instead of a manual command, fix Docker & add notice about macOS recommendation
This commit is contained in:
+30
-23
@@ -1,25 +1,32 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM node:lts-alpine AS builder
|
||||
WORKDIR /src
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
FROM node:lts-alpine
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
|
||||
ARG SUNO_COOKIE
|
||||
ARG BROWSER
|
||||
RUN if [ -z "$SUNO_COOKIE" ]; then echo "Warning: SUNO_COOKIE is not set"; fi
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM node:lts-bookworm AS builder
|
||||
WORKDIR /src
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
FROM node:lts-bookworm
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y libnss3 \
|
||||
libdbus-1-3 libatk1.0-0 libatk-bridge2.0-0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 \
|
||||
libgbm1 libxkbcommon0 libasound2 libcups2 xvfb
|
||||
|
||||
ARG SUNO_COOKIE
|
||||
RUN if [ -z "$SUNO_COOKIE" ]; then echo "Warning: SUNO_COOKIE is not set. You will have to set the cookies in the Cookie header of your requests."; fi
|
||||
ENV SUNO_COOKIE=${SUNO_COOKIE}
|
||||
RUN if [ -z "$BROWSER" ]; then echo "Warning: BROWSER is not set; will use chromium by default"; fi
|
||||
ENV BROWSER=${BROWSER:-chromium}
|
||||
# Disable GPU acceleration, as with it suno-api won't work in a Docker environment
|
||||
ENV BROWSER_DISABLE_GPU=true
|
||||
|
||||
RUN npm install --only=production
|
||||
RUN npx playwright install $BROWSER
|
||||
COPY --from=builder /src/.next ./.next
|
||||
EXPOSE 3000
|
||||
CMD ["npm", "run", "start"]
|
||||
RUN npm install --only=production
|
||||
|
||||
# Install all supported browsers, else switching browsers requires an image rebuild
|
||||
RUN npx playwright install chromium
|
||||
# RUN npx playwright install firefox
|
||||
|
||||
COPY --from=builder /src/.next ./.next
|
||||
EXPOSE 3000
|
||||
CMD ["npm", "run", "start"]
|
||||
Reference in New Issue
Block a user