Skip to content

Commit 5dcea3a

Browse files
author
Satej Sawant
committed
Fix frontend Dockerfile health check and remove hardcoded URL
1 parent ef2f013 commit 5dcea3a

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

docker-compose.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
version: '3.8'
22

33
services:
4+
frontend-service:
5+
build: ./frontend-service
6+
ports:
7+
- "8080:8080"
8+
healthcheck:
9+
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
10+
interval: 30s
11+
timeout: 10s
12+
retries: 3
13+
start_period: 40s
14+
networks:
15+
- spookymart-network
16+
417
product-service:
518
build: ./product-service
619
ports:

frontend-service/Dockerfile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ RUN npm install
1313
# Copy source code
1414
COPY . .
1515

16-
# Set environment variable for production build
17-
ENV REACT_APP_API_URL=http://spookymart-alb-1978027172.us-west-2.elb.amazonaws.com
18-
1916
# Build the application
2017
RUN npm run build
2118

@@ -44,9 +41,9 @@ USER spookymart
4441
# Expose port 8080
4542
EXPOSE 8080
4643

47-
# Health check
48-
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
44+
# Health check - check if serve is responding
45+
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
4946
CMD curl -f http://localhost:8080/ || exit 1
5047

5148
# Start serve to serve the static files
52-
CMD ["serve", "-s", "build", "-l", "8080"]
49+
CMD ["serve", "-s", "build", "-l", "8080", "--no-clipboard"]

0 commit comments

Comments
 (0)