Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat : create native image #800

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
12 changes: 9 additions & 3 deletions .github/workflows/api-gateway.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,15 @@ jobs:
- name: Build and analyze
run: ./mvnw clean verify

- if: ${{ github.ref == 'refs/heads/main' }}
name: Build Image and push to docker
- name: Start up softwares via Docker Compose
run: |
cd ../deployment
docker compose up config-server naming-server -d
sleep 10
docker ps -a

- name: Build Image and push to docker
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
DOCKER_PASSCODE: ${{secrets.DOCKER_PASSCODE}}
run: ./mvnw spring-boot:build-image -DskipTests -DCI_DOCKER_PASSWORD=${DOCKER_PASSCODE} -DCI_DOCKER_USERNAME=dockertmt -Dspring-boot.build-image.publish=true
run: ./mvnw -Pnative spring-boot:build-image -DskipTests -DCI_DOCKER_PASSWORD=${DOCKER_PASSCODE} -DCI_DOCKER_USERNAME=dockertmt -Dspring-boot.build-image.publish=true
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Licensed under MIT License Copyright (c) 2021-2022 Raja Kolli.
import org.springframework.stereotype.Component;

@Component
public class DataInitializer {
class DataInitializer {

private static final Logger log = LoggerFactory.getLogger(DataInitializer.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Licensed under MIT License Copyright (c) 2021-2022 Raja Kolli.
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ApiGatewayConfiguration {
@Configuration(proxyBeanMethods = false)
class ApiGatewayConfiguration {

@Bean
RouteLocator gatewayRouter(RouteLocatorBuilder builder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Licensed under MIT License Copyright (c) 2021-2022 Raja Kolli.
import org.springframework.security.crypto.password.PasswordEncoder;

@Configuration(proxyBeanMethods = false)
public class CircuitBreakerConfiguration {
class CircuitBreakerConfiguration {

@Bean
PasswordEncoder passwordEncoder() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Licensed under MIT License Copyright (c) 2021-2022 Raja Kolli.
import reactor.core.publisher.Mono;

@Component
public class LoggingFilter implements GlobalFilter {
class LoggingFilter implements GlobalFilter {

private static final Logger log = LoggerFactory.getLogger(LoggingFilter.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Licensed under MIT License Copyright (c) 2023 Raja Kolli.
import reactor.core.publisher.Mono;

@Configuration(proxyBeanMethods = false)
public class RateLimiterConfiguration {
class RateLimiterConfiguration {

@Bean
KeyResolver userKeyResolver() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Licensed under MIT License Copyright (c) 2022-2023 Raja Kolli.
security = @SecurityRequirement(name = "Authorization"))
@SecurityScheme(type = SecuritySchemeType.HTTP, scheme = "basic", name = "Authorization")
@AutoConfigureBefore(MultipleOpenApiSupportConfiguration.class)
public class SwaggerConfig {
class SwaggerConfig {

@Bean
@Lazy(value = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Licensed under MIT License Copyright (c) 2023 Raja Kolli.
import org.springframework.web.reactive.function.client.WebClient;

@Configuration(proxyBeanMethods = false)
public class WebClientConfiguration {
class WebClientConfiguration {

@Bean
@LoadBalanced
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Licensed under MIT License Copyright (c) 2023 Raja Kolli.
import org.springframework.web.reactive.config.WebFluxConfigurer;

@Configuration(proxyBeanMethods = false)
public class WebFluxConfig implements WebFluxConfigurer {
class WebFluxConfig implements WebFluxConfigurer {

@Override
public void addCorsMappings(CorsRegistry registry) {
Expand Down
1 change: 1 addition & 0 deletions api-gateway/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ spring:
application:
name: api-gateway
cloud:
refresh.enabled: false
gateway:
discovery:
locator:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ GenericContainer<?> zipkinContainer() {
@Bean
@ServiceConnection(name = "redis")
GenericContainer<?> redisContainer() {
return new GenericContainer<>(DockerImageName.parse("redis").withTag("7.2.3-alpine"))
return new GenericContainer<>(DockerImageName.parse("redis").withTag("7.2.5-alpine"))
.withExposedPorts(6379)
.withReuse(true);
}
Expand Down
1 change: 1 addition & 0 deletions api-gateway/src/test/resources/application-test.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
spring.cloud.refresh.enabled=false
Loading