-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
712 additions
and
461 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#### Start of builder image | ||
# ------------------------ | ||
# Builder stage to prepare application for final image | ||
FROM openjdk:14-slim-buster as builder | ||
WORKDIR temp | ||
|
||
# Fatjar location, but could be set to different location from command line | ||
ARG JAR_FILE=target/*.jar | ||
|
||
# Copy fat jar file to current image builder | ||
COPY ${JAR_FILE} application.jar | ||
|
||
# Extract the jar file layers | ||
RUN java -Djarmode=layertools -jar --enable-preview application.jar extract | ||
|
||
# Workaround to avoid Copy command failure when directory is not exists. | ||
RUN test ! -d ./snapshot-dependencies \ | ||
&& mkdir snapshot-dependencies \ | ||
&& echo "Directory [snapshot-dependencies] created." | ||
|
||
#### End of builder stage | ||
|
||
#### Start of actual image | ||
# ------------------------ | ||
# Build image based on JDK 14 base image, based on latest debian buster OS | ||
FROM openjdk:14-slim-buster | ||
VOLUME /tmp | ||
|
||
# Set image information, but could be set to different location from command line | ||
ARG IMAGE_VERSION="1.0-SNAPSHOT" | ||
ARG IMAGE_NAME="Edge Server" | ||
ARG MAINTAINER="Mohamed Taman <mohamed.taman@gmail.com>" | ||
|
||
LABEL version=${IMAGE_VERSION} name=${IMAGE_NAME} maintainer=${MAINTAINER} | ||
|
||
# Limiting security access to not user root user | ||
RUN addgroup siriusxi && useradd -g siriusxi -ms /bin/bash taman | ||
|
||
# Setting user to current created user | ||
USER taman | ||
|
||
# Set working directory to application folder | ||
WORKDIR /home/taman/application | ||
|
||
# Copy all layers from builder stage to current image | ||
COPY --from=builder temp/dependencies/ ./ | ||
COPY --from=builder temp/snapshot-dependencies/ ./ | ||
COPY --from=builder temp/spring-boot-loader/ ./ | ||
COPY --from=builder temp/application/ ./ | ||
|
||
# Expose current server to port 8080 | ||
EXPOSE 8761 | ||
|
||
ARG JAVA_OPTS="" | ||
|
||
# Run the application with JVM configs if any | ||
ENTRYPOINT ["bash", "-c", \ | ||
"java -server --enable-preview -XX:+UseContainerSupport -XX:+ShowCodeDetailsInExceptionMessages \ | ||
-XX:+AlwaysActAsServerClassMachine -XX:+UseG1GC -XX:+UseStringDeduplication ${JAVA_OPTS} \ | ||
org.springframework.boot.loader.JarLauncher ${0} ${@}"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.siriusxi.ms.store</groupId> | ||
<artifactId>store-cloud-chassis</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<relativePath>../store-base/store-cloud-chassis</relativePath> | ||
</parent> | ||
|
||
<groupId>com.siriusxi.cloud.infra</groupId> | ||
<artifactId>gateway</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>Edge Server</name> | ||
<description>Spring Cloud API Gateway Server, based on Spring boot.</description> | ||
<packaging>jar</packaging> | ||
|
||
<dependencies> | ||
<!-- Start - Spring cloud API Gateway server --> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-gateway</artifactId> | ||
</dependency> | ||
<!-- End - Spring cloud API Gateway server --> | ||
<!-- Start - To register API Gateway server with Eureka Discovery Server --> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> | ||
</dependency> | ||
<!-- End - To register API Gateway server with Eureka Discovery Server --> | ||
<!-- Start - Javax.validation is required to in order to test to work --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-validation</artifactId> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<!-- End - Javax.validation is required to in order to test to work --> | ||
</dependencies> | ||
|
||
</project> |
22 changes: 22 additions & 0 deletions
22
...fra/edge-server/src/main/java/com/siriusxi/cloud/infra/gateway/EdgeServerApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.siriusxi.cloud.infra.gateway; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.cloud.client.loadbalancer.LoadBalanced; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.web.reactive.function.client.WebClient; | ||
|
||
@SpringBootApplication | ||
public class EdgeServerApplication { | ||
|
||
@Bean | ||
@LoadBalanced | ||
public WebClient.Builder loadBalancedWebClientBuilder() { | ||
return WebClient.builder(); | ||
} | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(EdgeServerApplication.class, args); | ||
} | ||
|
||
} |
Oops, something went wrong.