# Use the official Deno 2.1.7 base image
FROM denoland/deno:2.1.7

# Set the working directory in the container
WORKDIR /app

# Prefer not to run as root.
USER deno

# Cache the dependencies as a layer to improve build performance
# Copy `deno.json` for dependency management
COPY deno.json ./

# Copy the rest of the application files
COPY . .

# The port that your application listens to.
EXPOSE 3000

# Compile the main application to improve startup time
RUN deno cache src/main.ts

# Use the appropriate task from `deno.json` for production
CMD ["deno", "task", "dev"]