Files
UT-Registration-Plus/Dockerfile
doprz a5e921fd75 feat(build): add Docker support (#322)
* feat(build): add Docker support

* fix: pnpm patches

* chore: update readme

* chore: refactor Docker section into separate markdown file

* chore: remove polling and host 0.0.0.0

* feat: add .dockerignore

* feat: update .dockerignore
2024-11-21 22:41:52 -06:00

48 lines
984 B
Docker

# Stage 1: Base image with Node.js and pnpm
FROM node:20.9.0-alpine AS base
# Install pnpm
RUN npm install -g pnpm
# Set working directory
WORKDIR /app
# Copy package.json, pnpm-lock.yaml, and .nvmrc
COPY package.json pnpm-lock.yaml .nvmrc ./
# Copy patches directory if it exists
COPY patches ./patches
# Install dependencies, including applying patches
RUN pnpm install --frozen-lockfile
# Copy the rest of the source code
COPY . .
# Stage 2: Final stage
FROM base AS final
# Install zip utility and bash
RUN apk add --no-cache zip bash
# Set working directory
WORKDIR /extension
# Copy all files from base
COPY --from=base /app ./
# Copy the entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/
# Make the entrypoint script executable
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Expose port for HMR
EXPOSE 5173
# Set the entrypoint to our new script
ENTRYPOINT ["docker-entrypoint.sh"]
# Set the default command (which can be overridden)
CMD ["build"]