Files
panel/Dockerfile

48 lines
1.3 KiB
Docker

# Use Node.js 22.11.0 as the base image
FROM node:22.11.0
# Set timezone to Europe/Warsaw (Polish timezone)
ENV TZ=Europe/Warsaw
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Install git
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# If building from a git repository, clone it
# This will be used when the build context doesn't include source files
ARG GIT_REPO_URL
ARG GIT_BRANCH=main
ARG GIT_COMMIT
# If GIT_REPO_URL is provided, clone the repo; otherwise copy local files
RUN if [ -n "$GIT_REPO_URL" ]; then \
git clone --branch ${GIT_BRANCH} ${GIT_REPO_URL} . && \
if [ -n "$GIT_COMMIT" ]; then git checkout ${GIT_COMMIT}; fi; \
fi
# Copy package.json and package-lock.json (if not cloned from git)
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy the rest of the app (if not cloned from git)
RUN if [ -z "$GIT_REPO_URL" ]; then echo "Copying local files..."; fi
COPY . .
# Build the application for production
RUN npm run build
# Copy the entrypoint script
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
# Expose the default Next.js port
EXPOSE 3000
# Use the entrypoint script
ENTRYPOINT ["/docker-entrypoint.sh"]