Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +22 -54
Dockerfile
CHANGED
@@ -1,65 +1,33 @@
|
|
1 |
-
FROM node:20
|
|
|
2 |
|
3 |
-
|
4 |
-
FROM base AS deps
|
5 |
-
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
6 |
-
RUN apk add --no-cache libc6-compat
|
7 |
-
WORKDIR /app
|
8 |
-
|
9 |
-
# Install dependencies based on the preferred package manager
|
10 |
-
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
|
11 |
-
RUN \
|
12 |
-
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
13 |
-
elif [ -f package-lock.json ]; then npm ci --force; \
|
14 |
-
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
|
15 |
-
else echo "Lockfile not found." && exit 1; \
|
16 |
-
fi
|
17 |
-
|
18 |
-
# Uncomment the following lines if you want to use a secret at buildtime,
|
19 |
-
# for example to access your private npm packages
|
20 |
-
# RUN --mount=type=secret,id=HF_EXAMPLE_SECRET,mode=0444,required=true \
|
21 |
-
# $(cat /run/secrets/HF_EXAMPLE_SECRET)
|
22 |
-
|
23 |
-
# Rebuild the source code only when needed
|
24 |
-
FROM base AS builder
|
25 |
-
WORKDIR /app
|
26 |
-
COPY --from=deps /app/node_modules ./node_modules
|
27 |
-
COPY . .
|
28 |
-
|
29 |
-
# Next.js collects completely anonymous telemetry data about general usage.
|
30 |
-
# Learn more here: https://nextjs.org/telemetry
|
31 |
-
# Uncomment the following line in case you want to disable telemetry during the build.
|
32 |
-
# ENV NEXT_TELEMETRY_DISABLED 1
|
33 |
-
|
34 |
-
# RUN yarn build
|
35 |
|
36 |
-
|
37 |
-
|
38 |
|
39 |
-
#
|
40 |
-
|
41 |
-
WORKDIR /app
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
# ENV NEXT_TELEMETRY_DISABLED 1
|
46 |
|
47 |
-
|
48 |
-
RUN
|
49 |
|
50 |
-
|
|
|
51 |
|
52 |
-
#
|
53 |
-
|
54 |
-
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
55 |
-
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
56 |
-
COPY --from=builder --chown=nextjs:nodejs /app/.next/cache ./.next/cache
|
57 |
-
# COPY --from=builder --chown=nextjs:nodejs /app/.next/cache/fetch-cache ./.next/cache/fetch-cache
|
58 |
|
59 |
-
|
60 |
|
61 |
-
|
|
|
62 |
|
63 |
-
|
|
|
64 |
|
65 |
-
|
|
|
|
1 |
+
FROM node:20
|
2 |
+
RUN npm install -g pnpm
|
3 |
|
4 |
+
EXPOSE 3000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
ENV PORT 3000
|
7 |
+
ENV HOSTNAME 0.0.0.0
|
8 |
|
9 |
+
# Create a non-root user
|
10 |
+
RUN useradd -m appuser
|
|
|
11 |
|
12 |
+
# Set the working directory
|
13 |
+
WORKDIR /home/appuser/react-video-editor
|
|
|
14 |
|
15 |
+
# Clone the code repository
|
16 |
+
RUN git clone https://github.com/designcombo/react-video-editor.git .
|
17 |
|
18 |
+
# Change ownership of the entire project directory
|
19 |
+
RUN chown -R appuser:appuser /home/appuser/react-video-editor
|
20 |
|
21 |
+
# Switch to the non-root user
|
22 |
+
USER appuser
|
|
|
|
|
|
|
|
|
23 |
|
24 |
+
# Install pnpm
|
25 |
|
26 |
+
# Install dependencies
|
27 |
+
RUN pnpm install
|
28 |
|
29 |
+
# Set permissions for the working directory
|
30 |
+
RUN chmod -R 777 /home/appuser/react-video-editor
|
31 |
|
32 |
+
# Start the application
|
33 |
+
CMD ["pnpm", "run", "dev", "--", "--host"]
|