-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (30 loc) · 907 Bytes
/
Dockerfile
File metadata and controls
44 lines (30 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Use Bun as base image for building
FROM oven/bun:1.3-alpine AS builder
WORKDIR /app
# Copy package files
COPY package.json bun.lockb* ./
# Install dependencies
RUN bun install --frozen-lockfile
# Copy source code
COPY src ./src
COPY tsconfig.json ./
# Build the application
RUN bun build src/index.ts --outdir dist --target bun
# Production image - Alpine with Bun and Skopeo
FROM oven/bun:1.3-alpine
WORKDIR /app
# Install skopeo from Alpine repositories
RUN apk add --no-cache skopeo
# Copy only the built application (single file bundle)
COPY --from=builder /app/dist/index.js .
# Create non-root user
RUN addgroup -g 1001 -S appuser && \
adduser -u 1001 -S appuser -G appuser
# Change ownership of the app directory
RUN chown -R appuser:appuser /app
# Switch to non-root user
USER appuser
# Expose ports
EXPOSE 8443 8080
# Run the application
ENTRYPOINT [ "bun", "run", "index.js" ]