Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +42 -22
Dockerfile
CHANGED
@@ -1,33 +1,53 @@
|
|
1 |
-
|
2 |
-
|
|
|
3 |
|
4 |
-
|
|
|
5 |
|
6 |
-
|
7 |
-
|
8 |
|
9 |
-
#
|
10 |
-
RUN
|
11 |
|
12 |
-
#
|
13 |
-
|
|
|
14 |
|
15 |
-
#
|
16 |
-
RUN
|
17 |
|
18 |
-
#
|
19 |
-
|
|
|
20 |
|
21 |
-
#
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
#
|
|
|
|
|
|
|
25 |
|
26 |
-
#
|
27 |
-
RUN
|
|
|
28 |
|
29 |
-
#
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
-
# Start the application
|
33 |
-
CMD ["
|
|
|
1 |
+
# Base stage
|
2 |
+
FROM oven/bun:alpine AS base
|
3 |
+
WORKDIR /base
|
4 |
|
5 |
+
# Install git to clone the repository
|
6 |
+
RUN apk --no-cache add git
|
7 |
|
8 |
+
# Clone the react-video-editor repository
|
9 |
+
RUN git clone https://github.com/designcombo/react-video-editor.git ./
|
10 |
|
11 |
+
# Install dependencies using bun
|
12 |
+
RUN bun install --frozen-lockfile
|
13 |
|
14 |
+
# Build stage
|
15 |
+
FROM base AS builder
|
16 |
+
WORKDIR /base
|
17 |
|
18 |
+
# Build the application using bun
|
19 |
+
RUN bun run build
|
20 |
|
21 |
+
# Runner stage
|
22 |
+
FROM builder AS runner
|
23 |
+
WORKDIR /app
|
24 |
|
25 |
+
# Set environment variables for production
|
26 |
+
ENV NODE_ENV production
|
27 |
+
ENV NEXT_TELEMETRY_DISABLED 1
|
28 |
+
|
29 |
+
# Create a non-root user for better security
|
30 |
+
RUN addgroup --system --gid 1001 nodejs
|
31 |
+
RUN adduser --system --uid 1001 bunuser
|
32 |
|
33 |
+
# Copy the public and build output files from the builder stage
|
34 |
+
COPY --from=builder /base/public ./public
|
35 |
+
COPY --from=builder /base/.next/standalone ./
|
36 |
+
COPY --from=builder /base/.next/static ./.next/static
|
37 |
|
38 |
+
# Set the correct permissions
|
39 |
+
RUN mkdir .next
|
40 |
+
RUN chown bunuser:nodejs .next
|
41 |
|
42 |
+
# Expose the port
|
43 |
+
EXPOSE 7860
|
44 |
+
|
45 |
+
# Set environment variables for hostname and port
|
46 |
+
ENV HOSTNAME 0.0.0.0
|
47 |
+
ENV PORT 7860
|
48 |
+
|
49 |
+
# Switch to the non-root user
|
50 |
+
USER bunuser
|
51 |
|
52 |
+
# Start the application with bun
|
53 |
+
CMD ["bun", "dev"]
|