add dockerfile
This commit is contained in:
32
Dockerfile
Normal file
32
Dockerfile
Normal file
@@ -0,0 +1,32 @@
|
||||
# Dockerfile for a Bun + Hono + SQLite application
|
||||
|
||||
# --- Base Image ---
|
||||
FROM oven/bun:1-alpine
|
||||
|
||||
# --- Environment Variables ---
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# --- Working Directory ---
|
||||
WORKDIR /app
|
||||
|
||||
# --- Copy package.json and bun.lockb to leverage Docker cache ---
|
||||
COPY package.json bun.lockb ./
|
||||
|
||||
# --- Install Dependencies ---
|
||||
# Do not install devDependencies to keep the image small
|
||||
RUN bun install --frozen-lockfile --production
|
||||
|
||||
# --- Copy application source code ---
|
||||
COPY . .
|
||||
|
||||
# --- Create dedicated directory for SQLite database ---
|
||||
# Declare a VOLUME for the database directory so data persists after container restarts.
|
||||
RUN mkdir -p /app/data
|
||||
VOLUME /app/data
|
||||
|
||||
# --- Expose Port ---
|
||||
EXPOSE 3000
|
||||
|
||||
# --- Command to run the application ---
|
||||
# Ensure the Hono app listens on 0.0.0.0
|
||||
CMD ["bun", "run", "src/index.ts"]
|
||||
Reference in New Issue
Block a user