Skip to content

Commit

Permalink
Fix ui Dockerfile not building correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
sneakycrow committed Nov 9, 2024
1 parent 367d228 commit 5bfea8d
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions config/ui.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
# Build stage
FROM --platform=$BUILDPLATFORM node:20-slim as builder
FROM --platform=$BUILDPLATFORM node:22-slim as builder

# Set working directory
WORKDIR /app

# Copy package files
COPY services/barn-ui/package.json services/barn-ui/yarn.lock ./
# Copy root package.json and yarn.lock
COPY package.json yarn.lock ./

# Install dependencies
RUN yarn install --frozen-lockfile
# Copy UI package.json
COPY services/barn-ui/package.json services/barn-ui/
COPY services/barn-ui/yarn.lock services/barn-ui/

# Copy source files
COPY services/barn-ui .
# Install all dependencies (including dev dependencies)
RUN yarn install

# Build the application
RUN yarn build
# Copy UI source code
COPY services/barn-ui/ services/barn-ui/

# Build the UI application
RUN yarn workspace web build

# Runtime stage
FROM --platform=$TARGETPLATFORM node:20-slim
FROM --platform=$TARGETPLATFORM node:22-slim

# Set working directory
WORKDIR /app

# Copy package files for production dependencies
COPY services/barn-ui/package.json services/barn-ui/yarn.lock ./

# Install production dependencies only
RUN yarn install --production --frozen-lockfile
# Copy only production dependencies
COPY --from=builder /app/services/barn-ui/package.json ./
COPY --from=builder /app/services/barn-ui/yarn.lock ./
RUN yarn install --production

# Copy built application from builder
COPY --from=builder /app/build ./build
# Copy built application
COPY --from=builder /app/services/barn-ui/build ./build

# Expose default SvelteKit port
# Expose port
EXPOSE 3000

# Start the application
Expand Down

0 comments on commit 5bfea8d

Please sign in to comment.