Spaces:
Runtime error
Runtime error
Create dev.Dockerfile
Browse files- dev.Dockerfile +62 -0
dev.Dockerfile
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM node:19-alpine
|
| 2 |
+
|
| 3 |
+
RUN apk update && apk add --no-cache openssl
|
| 4 |
+
|
| 5 |
+
ARG NEXTAUTH_SECRET=$(openssl rand -base64 32)
|
| 6 |
+
ENV NEXTAUTH_SECRET=$NEXTAUTH_SECRET
|
| 7 |
+
|
| 8 |
+
ARG DATABASE_URL
|
| 9 |
+
ENV DATABASE_URL=$DATABASE_URL
|
| 10 |
+
|
| 11 |
+
ARG NEXTAUTH_SECRET=
|
| 12 |
+
ENV NEXTAUTH_SECRET=$NEXTAUTH_SECRET
|
| 13 |
+
|
| 14 |
+
ARG NEXTAUTH_URL
|
| 15 |
+
ENV NEXTAUTH_URL=$NEXTAUTH_URL
|
| 16 |
+
|
| 17 |
+
ARG SKIP_ENV_VALIDATION
|
| 18 |
+
ENV SKIP_ENV_VALIDATION=$SKIP_ENV_VALIDATION
|
| 19 |
+
|
| 20 |
+
WORKDIR /app
|
| 21 |
+
|
| 22 |
+
# Ensure the app module is copied to the correct location
|
| 23 |
+
COPY app.py /app/app.py
|
| 24 |
+
|
| 25 |
+
# Install dependencies based on the preferred package manager
|
| 26 |
+
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
|
| 27 |
+
|
| 28 |
+
# Copy the rest of the application code
|
| 29 |
+
COPY . .
|
| 30 |
+
|
| 31 |
+
# Prevent Husky errors by disabling the `prepare` script
|
| 32 |
+
RUN npm pkg set scripts.prepare="exit 0"
|
| 33 |
+
|
| 34 |
+
# set npm registry
|
| 35 |
+
RUN npm config set registry 'https://registry.npmmirror.com/'
|
| 36 |
+
|
| 37 |
+
RUN \
|
| 38 |
+
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
| 39 |
+
elif [ -f package-lock.json ]; then npm ci; \
|
| 40 |
+
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i; \
|
| 41 |
+
# Allow install without lockfile, so example works even without Node.js installed locally
|
| 42 |
+
else echo "Warning: Lockfile not found. It is recommended to commit lockfiles to version control." && yarn install; \
|
| 43 |
+
fi
|
| 44 |
+
|
| 45 |
+
# Ensure the app module is in the Python path
|
| 46 |
+
ENV PYTHONPATH="/app:${PYTHONPATH}"
|
| 47 |
+
|
| 48 |
+
ENTRYPOINT ["sh", "entrypoint.sh"]
|
| 49 |
+
|
| 50 |
+
# Next.js collects completely anonymous telemetry data about general usage. Learn more here: https://nextjs.org/telemetry
|
| 51 |
+
# Uncomment the following line to disable telemetry at run time
|
| 52 |
+
# ENV NEXT_TELEMETRY_DISABLED 1
|
| 53 |
+
|
| 54 |
+
# Note: Don't expose ports here, Compose will handle that for us
|
| 55 |
+
|
| 56 |
+
# Start Next.js in development mode based on the preferred package manager
|
| 57 |
+
CMD \
|
| 58 |
+
if [ -f yarn.lock ]; then yarn dev; \
|
| 59 |
+
elif [ -f package-lock.json ]; then npm run dev; \
|
| 60 |
+
elif [ -f pnpm-lock.yaml ]; then pnpm dev; \
|
| 61 |
+
else yarn dev; \
|
| 62 |
+
fi
|