diff --git a/.env.example b/.env.example index 2985555..4dd169b 100644 --- a/.env.example +++ b/.env.example @@ -10,6 +10,7 @@ # should be updated accordingly. # General +NEXT_TELEMETRY_DISABLED="true" NODE_ENV="development" NEXT_PUBLIC_SITE_URL="http://localhost:3000" diff --git a/Dockerfile b/Dockerfile index 89d2df1..1a3bdd7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,8 @@ FROM base AS deps WORKDIR /app +ENV NODE_ENV=production + # Install dependencies COPY package.json bun.lockb ./ RUN bun install --frozen-lockfile @@ -15,10 +17,25 @@ WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . -# Disable telemetry during the build +ENV NODE_ENV=production ENV NEXT_TELEMETRY_DISABLED=1 ENV SKIP_ENV_VALIDATION=true +# Set environment variables during the build +ARG NEXT_PUBLIC_SITE_URL +ARG DATABASE_USER +ARG DATABASE_PASSWORD +ARG DATABASE_HOST +ARG DATABASE_PORT +ARG DATABASE_NAME + +ENV NEXT_PUBLIC_SITE_URL=$NEXT_PUBLIC_SITE_URL +ENV DATABASE_USER=$DATABASE_USER +ENV DATABASE_PASSWORD=$DATABASE_PASSWORD +ENV DATABASE_HOST=$DATABASE_HOST +ENV DATABASE_PORT=$DATABASE_PORT +ENV DATABASE_NAME=$DATABASE_NAME + # Build the application RUN bunx next build diff --git a/docker-compose.yml b/docker-compose.yml index 50e0d20..c7fde7c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,13 @@ services: build: context: . dockerfile: Dockerfile + args: + - NEXT_PUBLIC_SITE_URL + - DATABASE_USER + - DATABASE_PASSWORD + - DATABASE_HOST + - DATABASE_PORT + - DATABASE_NAME ports: - "3000:3000" db: