-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
9b3839f
commit 053e138
Showing
5 changed files
with
63 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
varsEncrypted: true | ||
lastContext: | ||
namespace: template-java | ||
context: docker-desktop |
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 |
---|---|---|
@@ -1,15 +1,28 @@ | ||
################ Build & Dev ################ | ||
# Build stage will be used: | ||
# - for building the application for production | ||
# - as target for development (see devspace.yaml) | ||
FROM maven:3.8.7-openjdk-18-slim as base | ||
|
||
FROM base as ci | ||
# Create project directory (workdir) | ||
WORKDIR /app | ||
COPY . . | ||
|
||
FROM ci as builder | ||
WORKDIR /app | ||
RUN mvn package -Dmaven.test.skip=true | ||
|
||
FROM builder as shipment | ||
################ Production ################ | ||
# Creates a minimal image for production using distroless base image | ||
# More info here: https://github.com/GoogleContainerTools/distroless | ||
# FROM builder as shipment | ||
FROM gcr.io/distroless/java:11 as production | ||
WORKDIR /app | ||
COPY --from=builder /app/target/template-java.jar . | ||
COPY --from=builder /app/target/app.jar . | ||
|
||
ENTRYPOINT ["java","-jar", "/app/template-java.jar"] | ||
# Application port (optional) | ||
EXPOSE 8080 | ||
|
||
# Container start command for production | ||
ENTRYPOINT ["java","-jar", "/app/app.jar"] |
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,26 @@ | ||
#!/bin/bash | ||
|
||
echo "Installing maven dependencies" | ||
|
||
COLOR_CYAN="\033[0;36m" | ||
COLOR_RESET="\033[0m" | ||
|
||
echo -e "${COLOR_CYAN} | ||
____ ____ | ||
| _ \ _____ __/ ___| _ __ __ _ ___ ___ | ||
| | | |/ _ \ \ / /\___ \| '_ \ / _\` |/ __/ _ \\ | ||
| |_| | __/\ V / ___) | |_) | (_| | (_| __/ | ||
|____/ \___| \_/ |____/| .__/ \__,_|\___\___| | ||
|_| | ||
${COLOR_RESET} | ||
Welcome to your development container! | ||
This is how you can work with it: | ||
- Run \`${COLOR_CYAN}mvn spring-boot:run${COLOR_RESET}\` to run the application | ||
- Run \`${COLOR_CYAN}mvn package -T 1C -U -Dmaven.test.skip=true${COLOR_RESET}\` to build the application | ||
- ${COLOR_CYAN}Files will be synchronized${COLOR_RESET} between your local machine and this container (triggers build process) | ||
- Some ports will be forwarded, so you can access this container on your local machine via ${COLOR_CYAN}localhost${COLOR_RESET}:" | ||
|
||
devspace list ports | ||
|
||
bash |
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