38 lines
780 B
Docker
38 lines
780 B
Docker
FROM arm64v8/node:20-bullseye # Use an ARM-compatible Node.js image
|
|
|
|
# Create application directory
|
|
RUN mkdir -p /usr/src/app
|
|
|
|
# Set environment variables
|
|
ENV PORT=3000
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
# Copy package.json and pnpm-lock.yaml
|
|
COPY package.json /usr/src/app
|
|
COPY pnpm-lock.yaml /usr/src/app
|
|
|
|
# Install build tools
|
|
RUN apt-get update && apt-get install -y build-essential
|
|
|
|
# Install pnpm
|
|
RUN corepack enable pnpm
|
|
|
|
# Install dependencies
|
|
RUN pnpm install
|
|
|
|
# Copy the rest of the application code
|
|
COPY . /usr/src/app
|
|
|
|
# Initialize Database, if it not already exists
|
|
RUN pnpm run db
|
|
|
|
# Build the application
|
|
RUN pnpm run build
|
|
|
|
EXPOSE 3000
|
|
|
|
# Start the application
|
|
CMD ["/bin/sh", "-c", "if [ ! -f ./db/sqlite.db ]; then pnpm db; fi && pnpm start"]
|