V2
This commit is contained in:
45
frontend/Dockerfile
Normal file
45
frontend/Dockerfile
Normal file
@ -0,0 +1,45 @@
|
||||
# Step 1: Build the application
|
||||
FROM node:18 AS build
|
||||
|
||||
ARG VITE_API_HOST
|
||||
ARG VITE_API_PORT
|
||||
|
||||
# Use ARG to Set ENV (if needed)
|
||||
ENV VITE_API_HOST=${VITE_API_HOST}
|
||||
ENV VITE_API_PORT=${VITE_API_PORT}
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Copy package.json and package-lock.json
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Copy project files
|
||||
COPY . .
|
||||
|
||||
# Build the SvelteKit application
|
||||
RUN npm run build
|
||||
|
||||
# Step 2: Run the application
|
||||
FROM node:18
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Copy package.json and package-lock.json
|
||||
COPY package*.json ./
|
||||
|
||||
# Install production dependencies only
|
||||
RUN npm install --production
|
||||
|
||||
# Copy built files from the build stage
|
||||
COPY --from=build /usr/src/app/build ./build
|
||||
|
||||
# Expose the port the app runs on
|
||||
EXPOSE 3000
|
||||
|
||||
# Define the command to run the app
|
||||
CMD ["node", "build"]
|
||||
Reference in New Issue
Block a user