30 lines
670 B
Docker
30 lines
670 B
Docker
FROM node:18 AS build
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package.json and package-lock.json (or yarn.lock)
|
|
COPY package.json ./
|
|
COPY package-lock.json ./
|
|
|
|
# Install dependencies (including TypeScript)
|
|
RUN npm install
|
|
|
|
# Install TypeScript globally (if not installed in package.json)
|
|
RUN npm install -g typescript
|
|
|
|
# Copy the rest of the application files
|
|
COPY . .
|
|
|
|
# Run the build command (tsc -b and vite build)
|
|
RUN npm run build # This will run tsc -b and vite build
|
|
|
|
# Expose the port the app will use
|
|
EXPOSE 4173
|
|
|
|
# Copy the entrypoint script
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
# Start the app using the preview server
|
|
CMD ["npm", "run", "preview"]
|