Skip to content

Commit

Permalink
Merge pull request #241 from Tauffer-Consulting/fix/frontend-image-build
Browse files Browse the repository at this point in the history
fix: dockerfile frontend
  • Loading branch information
vinicvaz authored Feb 19, 2024
2 parents 64c36f3 + 4cad784 commit 9548977
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion frontend/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN corepack enable
FROM base as build
WORKDIR /usr/src/app
COPY package.json pnpm-lock.yaml ./
RUN pnpm install
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile

# Debug Stage
FROM base as debug
Expand Down
17 changes: 9 additions & 8 deletions frontend/Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
# Install pnpm
FROM node:18-alpine as base
# Stage 1: Build the React app
FROM node:18-slim as build
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable

# Build the React app
FROM base as build
# Set the working directory
WORKDIR /app

# Copy package.json and yarn.lock files
COPY package.json pnpm-lock.yaml ./
RUN pnpm install

# Import ENVs to the builded app
# Install dependencies
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile

RUN npx pkg ./node_modules/@import-meta-env/cli/bin/import-meta-env.js \
-o import-meta-env -y

# Copy the rest of the source code
COPY . .

# Build the app for production
RUN pnpm build
RUN pnpm run build

# Stage 2: Create a minimal NGINX image
FROM nginx:1.25.2
Expand Down

0 comments on commit 9548977

Please sign in to comment.