diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2bcec4c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +# Dockerfile for Astro webapp +# Use official Node.js image as the base +FROM node:20-alpine as build + +# Set working directory +WORKDIR /app + +# Copy package files and install dependencies +COPY package.json package-lock.json ./ +RUN npm ci + +# Copy the rest of the application code +COPY . . + +# Build the Astro project +RUN npm run build + +# Production image +FROM node:20-alpine as prod +WORKDIR /app + +# Install only production dependencies +COPY package.json package-lock.json ./ +RUN npm ci --omit=dev + +# Copy built files from build stage +COPY --from=build /app/dist ./dist +COPY public ./public + +# Expose Astro's default port +EXPOSE 4321 + +# Start the Astro preview server +CMD ["npx", "astro", "preview"]