Skip to content

Commit

Permalink
fix: dockerfile platform
Browse files Browse the repository at this point in the history
  • Loading branch information
ZZ3n committed Sep 17, 2024
1 parent 3edde11 commit 47334d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
FROM --platform=linux/amd64 node:18 AS pre
FROM --platform=linux/arm64 node:18 AS pre
WORKDIR /app
RUN apt-get update && \
apt-get install -y python3 make g++ build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev && \
apt-get clean

# 1. Install dependencies only when needed
FROM --platform=linux/amd64 pre AS deps
FROM --platform=linux/arm64 pre AS deps
WORKDIR /app
RUN npm install -g node-gyp
COPY package.json yarn.lock* ./
RUN yarn install --frozen-lockfile

# 2. Rebuild the source code only when needed
FROM --platform=linux/amd64 pre AS builder
FROM --platform=linux/arm64 pre AS builder
WORKDIR /app
COPY . .
COPY --from=deps /app/node_modules ./node_modules
RUN yarn build

# 3. Production image, copy all the files you need to run the app
FROM --platform=linux/amd64 node:18-alpine AS runner
FROM --platform=linux/arm64 node:18-alpine AS runner
WORKDIR /app

# Install curl for health check
Expand Down
2 changes: 1 addition & 1 deletion scripts/push-to-ecr-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ else
fi

echo "Step 2: Building Docker image for platform linux/arm64 with tag chunsik/dev/fe"
docker build --platform linux/arm64 -t chunsik/dev/fe --target dev ..
docker build --platform linux/arm64 -t chunsik/dev/fe ..
if [ $? -eq 0 ]; then
echo -e "${GREEN}Docker image built successfully.${NC}"
else
Expand Down

0 comments on commit 47334d6

Please sign in to comment.