Skip to content

Commit 78c6eab

Browse files
committed
fix: Dockerfile fix
1 parent 355bfa8 commit 78c6eab

File tree

1 file changed

+6
-29
lines changed

1 file changed

+6
-29
lines changed

Dockerfile

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,23 @@
1-
# ----------- Build Stage -----------
2-
FROM oven/bun:1 AS build
3-
4-
WORKDIR /app
5-
6-
# Copy only the lockfile and package manifest first for better caching
7-
COPY autoproject/package.json autoproject/bun.lockb* ./
8-
9-
# Install dependencies with strict lockfile
10-
RUN bun install --frozen-lockfile --no-progress
11-
12-
# Copy the rest of the source code
13-
COPY autoproject/ ./
14-
15-
# Build your app
16-
RUN bun run build
17-
18-
# ----------- Production Stage -----------
191
FROM oven/bun:1-slim AS production
202

21-
# Create a non-root user
3+
RUN apt-get update \
4+
&& apt-get install -y --no-install-recommends adduser \
5+
&& rm -rf /var/lib/apt/lists/*
6+
227
RUN adduser --disabled-password --gecos "" appuser
238

249
WORKDIR /app
2510

26-
# Copy only the necessary artifacts
2711
COPY --from=build /app/build ./build
2812
COPY --from=build /app/package.json ./
29-
COPY --from=build /app/node_modules ./node_modules
3013

31-
# Environment variables
14+
RUN bun install --production --no-progress
15+
3216
ENV NODE_ENV=production
3317
ENV PORT=3000
3418
ENV HOST=0.0.0.0
3519

36-
# Switch to non-root user
3720
USER appuser
38-
39-
# Expose the port
4021
EXPOSE 3000
4122

42-
# Optional: health check (uncomment and customize if needed)
43-
# HEALTHCHECK --interval=30s --timeout=5s --start-period=5s CMD curl -f http://localhost:3000/health || exit 1
44-
45-
# Start the app
4623
CMD ["bun", "build/index.js"]

0 commit comments

Comments
 (0)