Skip to content

Commit d8c808a

Browse files
authored
Docker static ip (#12)
* feat: static ip for the api-gateway docker container * feat: adding the spring profile for pre environment to the docker run
1 parent 99c5179 commit d8c808a

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

.github/workflows/deploy-pre.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ jobs:
5454
docker load < api-gateway.tar.gz
5555
5656
# Run the new container
57-
docker run -d --name api-gateway --restart always api-gateway:latest
57+
docker run -d --name api-gateway -e SPRING_PROFILES_ACTIVE=dev --restart always api-gateway:latest

docker/Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ COPY pom.xml ./
88
COPY src/ ./src
99

1010
RUN chmod +x mvnw && \
11-
# ./mvnw clean install
1211
./mvnw install -DskipTests
1312
# Package the application (this creates the JAR file)
1413
RUN mvn clean package -DskipTests
@@ -18,10 +17,10 @@ FROM openjdk:23-jdk-slim
1817
WORKDIR /app
1918

2019
# Copy the built JAR from the first stage
21-
COPY --from=build /app/target/summonerssync.apigateway-0.0.1-SNAPSHOT.jar app.jar
20+
COPY --from=build /app/target/summonerssync.apigateway-0.0.1-SNAPSHOT.jar ag-summoners-sync.jar
2221

2322
# Expose the port the app runs on
2423
EXPOSE 8080
2524

2625
# Run Spring Boot app
27-
CMD ["java", "-jar", "app.jar"]
26+
CMD ["java", "-jar", "ag-summoners-sync.jar"]

docker/docker-compose.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@ services:
77
image: api-gateway:latest
88
ports:
99
- "8080:8080"
10+
networks:
11+
api_gateway_network:
12+
ipv4_address: 172.17.0.2
1013
environment:
11-
SPRING_DATASOURCE_URL: jdbc:postgresql://database:5432/gatewaydb
12-
SPRING_DATASOURCE_USERNAME: admin
13-
SPRING_DATASOURCE_PASSWORD: admin
1414
SPRING_PROFILES_ACTIVE: dev
15+
networks:
16+
api_gateway_network:
17+
driver: bridge
18+
ipam:
19+
config:
20+
- subnet: 172.17.0.2/16
1521

0 commit comments

Comments
 (0)