You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
910 B
Docker

FROM node:22-alpine
ARG NEXT_PUBLIC_PYTHON_API_URL
ARG NEXT_PUBLIC_SWISSOID_TARGET_SERVICE_HANDLE
ARG NEXT_PUBLIC_AUTH_BACKEND_URL
ARG NEXT_PUBLIC_APP_VERSION
ENV NEXT_PUBLIC_PYTHON_API_URL=${NEXT_PUBLIC_PYTHON_API_URL}
ENV NEXT_PUBLIC_SWISSOID_TARGET_SERVICE_HANDLE=${NEXT_PUBLIC_SWISSOID_TARGET_SERVICE_HANDLE}
ENV NEXT_PUBLIC_AUTH_BACKEND_URL=${NEXT_PUBLIC_AUTH_BACKEND_URL}
ENV NEXT_PUBLIC_APP_VERSION=${NEXT_PUBLIC_APP_VERSION}
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm install next -g
RUN npm ci
# Copy the rest of the app
COPY . .
# Build the application (skip linting)
ENV NEXT_TELEMETRY_DISABLED=1
RUN npm run build || (echo "Build failed, retrying with verbose logging" && npm run build --verbose)
# Remove dev dependencies
RUN npm prune --production
RUN ls -la
# Expose the port
EXPOSE 8000
# Start the production server
CMD ["npm", "start"]