Some checks failed
Deploy Encrypted Todo App / build-and-push (push) Has been cancelled
39 lines
816 B
Docker
39 lines
816 B
Docker
FROM node:24-alpine
|
|
|
|
# Install pnpm
|
|
RUN npm install -g pnpm
|
|
|
|
# Set the working directory in the container
|
|
WORKDIR /app
|
|
|
|
# Copy package.json and pnpm-lock.yaml (if available)
|
|
COPY package*.json pnpm-lock.yaml* ./
|
|
|
|
# Install dependencies
|
|
RUN pnpm install --frozen-lockfile --prod
|
|
|
|
# Copy the rest of the application code
|
|
COPY . .
|
|
|
|
# Create a directory for the SQLite database
|
|
RUN mkdir -p /app/data
|
|
|
|
# Set environment variables
|
|
ENV NODE_ENV=production
|
|
ENV SQLITE_DB_PATH=/app/data/db.db
|
|
ENV PORT=3000
|
|
|
|
# Expose the port the app runs on
|
|
EXPOSE 3000
|
|
|
|
# Create a non-root user to run the application
|
|
RUN addgroup -g 1001 -S nodejs
|
|
RUN adduser -S nodejs -u 1001
|
|
|
|
# Change ownership of the app directory to the nodejs user
|
|
RUN chown -R nodejs:nodejs /app
|
|
USER nodejs
|
|
|
|
# Command to run the application
|
|
CMD ["pnpm", "start"]
|