Skip to content

Commit

Permalink
Fix Dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
sneakycrow committed Feb 15, 2025
1 parent 900d80d commit 03636ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 2 additions & 0 deletions config/api.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ FROM chef AS planner
COPY Cargo.lock Cargo.lock
COPY Cargo.toml Cargo.toml
COPY src/ src/
COPY migrations/ migrations/
RUN cargo chef prepare --recipe-path recipe.json

FROM chef AS builder
Expand All @@ -19,6 +20,7 @@ RUN cargo chef cook --release --recipe-path recipe.json
COPY Cargo.lock Cargo.lock
COPY Cargo.toml Cargo.toml
COPY src/ src/
COPY migrations/ migrations/
RUN cargo build --release --bin api

# Runtime stage
Expand Down
17 changes: 8 additions & 9 deletions config/ui.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@ FROM --platform=$BUILDPLATFORM node:22-slim as builder
WORKDIR /app

# Copy root package.json and yarn.lock
COPY package.json yarn.lock ./

# Copy UI package.json
COPY services/barn-ui/package.json services/barn-ui/
COPY services/barn-ui/yarn.lock services/barn-ui/
COPY package.json package.json
COPY yarn.lock yarn.lock
COPY web/package.json web/package.json
COPY web/yarn.lock web/yarn.lock

# Install all dependencies (including dev dependencies)
RUN yarn install

# Copy UI source code
COPY services/barn-ui/ services/barn-ui/
COPY web/ web/

# Build the UI application
RUN yarn workspace web build
Expand All @@ -27,12 +26,12 @@ FROM --platform=$TARGETPLATFORM node:22-slim
WORKDIR /app

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

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

# Expose port
EXPOSE 3000
Expand Down

0 comments on commit 03636ba

Please sign in to comment.