Skip to content

Commit 5f96ce4

Browse files
kenahrensclaude
andcommitted
fix: Remove Alpine Linux dependencies to resolve CI/CD build failures
- Replace node:20-alpine with node:20 for frontend service - Replace amazoncorretto:20-alpine with amazoncorretto:20 for all backend services - Fix user creation commands for standard base images (groupadd/useradd vs addgroup/adduser) - Install required system packages (shadow-utils, curl) via yum for Amazon Corretto - Remove invalid npm timeout config option for Node.js compatibility - Remove problematic curl installation after user switch in frontend Fixes permission errors, package compatibility issues, and Alpine-specific build failures. All builds tested and validated locally before commit. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent c922551 commit 5f96ce4

5 files changed

Lines changed: 32 additions & 31 deletions

File tree

backend/accounts-service/Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ COPY src ./src
1414
RUN mvn clean package -DskipTests
1515

1616
# Runtime image
17-
FROM amazoncorretto:20-alpine
17+
FROM amazoncorretto:20
1818

1919
WORKDIR /app
2020

21-
# Install curl for health checks and create non-root user
22-
RUN apk add --no-cache curl && \
23-
addgroup -g 1001 -S appuser && \
24-
adduser -S appuser -u 1001
21+
# Install necessary tools and create non-root user
22+
RUN yum update -y && \
23+
yum install -y shadow-utils curl && \
24+
groupadd -g 1001 appuser && \
25+
useradd -u 1001 -g appuser -s /bin/bash appuser
2526

2627
# Copy the built JAR file
2728
COPY --from=builder /app/target/accounts-service-*.jar app.jar

backend/api-gateway/Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ COPY src ./src
1414
RUN mvn clean package -DskipTests
1515

1616
# Runtime image
17-
FROM amazoncorretto:20-alpine
17+
FROM amazoncorretto:20
1818

1919
WORKDIR /app
2020

21-
# Install curl for health checks and create non-root user
22-
RUN apk add --no-cache curl && \
23-
addgroup -g 1001 -S appuser && \
24-
adduser -S appuser -u 1001 -G appuser
21+
# Install necessary tools and create non-root user
22+
RUN yum update -y && \
23+
yum install -y shadow-utils curl && \
24+
groupadd -g 1001 appuser && \
25+
useradd -u 1001 -g appuser -s /bin/bash appuser
2526

2627
# Copy the built JAR file
2728
COPY --from=builder /app/target/api-gateway-*.jar app.jar

backend/transactions-service/Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ COPY src ./src
1414
RUN mvn clean package -DskipTests
1515

1616
# Runtime image
17-
FROM amazoncorretto:20-alpine
17+
FROM amazoncorretto:20
1818

1919
WORKDIR /app
2020

21-
# Install curl for health checks and create non-root user
22-
RUN apk add --no-cache curl && \
23-
addgroup -g 1001 -S appuser && \
24-
adduser -S appuser -u 1001
21+
# Install necessary tools and create non-root user
22+
RUN yum update -y && \
23+
yum install -y shadow-utils curl && \
24+
groupadd -g 1001 appuser && \
25+
useradd -u 1001 -g appuser -s /bin/bash appuser
2526

2627
# Copy the built JAR file
2728
COPY --from=builder /app/target/transactions-service-*.jar app.jar

backend/user-service/Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ COPY src ./src
1414
RUN mvn clean package -DskipTests
1515

1616
# Runtime image
17-
FROM amazoncorretto:20-alpine
17+
FROM amazoncorretto:20
1818

1919
WORKDIR /app
2020

21-
# Install curl for health checks and create non-root user
22-
RUN apk add --no-cache curl && \
23-
addgroup -g 1001 -S appuser && \
24-
adduser -S appuser -u 1001
21+
# Install necessary tools and create non-root user
22+
RUN yum update -y && \
23+
yum install -y shadow-utils curl && \
24+
groupadd -g 1001 appuser && \
25+
useradd -u 1001 -g appuser -s /bin/bash appuser
2526

2627
# Copy the built JAR file
2728
COPY --from=builder /app/target/user-service-*.jar app.jar

frontend/Dockerfile

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
# Multi-stage build for Next.js frontend
2-
FROM node:20-alpine AS builder
2+
FROM node:20 AS builder
33

44
WORKDIR /app
55

6-
# Install curl for debugging and update npm to latest version
7-
RUN apk add --no-cache curl && \
8-
npm install -g npm@latest
6+
# Update npm to latest version
7+
RUN npm install -g npm@latest
98

109
# Copy package files
1110
COPY package.json package-lock.json ./
1211

1312
# Install dependencies with npm ci for faster, reliable installs
1413
RUN npm config set registry https://registry.npmjs.org/ && \
15-
npm config set timeout 60000 && \
1614
npm config set fetch-retries 3 && \
1715
npm ci --no-audit --loglevel error
1816

@@ -23,13 +21,13 @@ COPY . .
2321
RUN npm run build
2422

2523
# Runtime image
26-
FROM node:20-alpine
24+
FROM node:20
2725

2826
WORKDIR /app
2927

30-
# Create non-root user (Alpine syntax)
31-
RUN addgroup -g 1001 nodejs && \
32-
adduser -u 1001 -G nodejs -s /bin/sh -D nextjs
28+
# Create non-root user
29+
RUN groupadd -g 1001 nodejs && \
30+
useradd -u 1001 -g nodejs -s /bin/bash nextjs
3331

3432
# Copy built application
3533
COPY --from=builder /app/public ./public
@@ -45,8 +43,7 @@ USER nextjs
4543
# Expose port
4644
EXPOSE 3000
4745

48-
# Health check (using curl which is available in Alpine)
49-
RUN apk add --no-cache curl
46+
# Health check
5047
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
5148
CMD curl -f http://localhost:3000 || exit 1
5249

0 commit comments

Comments
 (0)