-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding files needed for the dockerization of the app
Signed-off-by: Alfredo Gutierrez <[email protected]>
- Loading branch information
1 parent
6e8a3e8
commit 7aa2716
Showing
8 changed files
with
117 additions
and
0 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 |
---|---|---|
|
@@ -47,3 +47,5 @@ gradle-app.setting | |
# JDT-specific (Eclipse Java Development Tools) | ||
.classpath | ||
|
||
# .env files | ||
server/docker/.env |
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,9 @@ | ||
*.iml | ||
*.md | ||
*.sw* | ||
*.csv | ||
|
||
mvnw* | ||
LICENSE* | ||
|
||
.java-version |
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,20 @@ | ||
# Use Eclipse Temurin with Java 21 as the base image | ||
FROM eclipse-temurin:21 | ||
|
||
# Define version | ||
ARG VERSION | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /app | ||
|
||
# Copy Distribution TAR file | ||
COPY --from=distributions server-${VERSION}.tar . | ||
|
||
# Extract the TAR file | ||
RUN tar -xvf server-${VERSION}.tar | ||
|
||
# Expose the port that the application will run on | ||
EXPOSE 8080 | ||
|
||
# RUN the bin script for starting the server | ||
ENTRYPOINT ["sh", "-c", "/app/server-${VERSION}/bin/server"] |
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,8 @@ | ||
This folder contains file that are used to start the services as docker containers. | ||
All docker workflows are defined with a corresponding gradle task. No script or file in this folder should be called 'by hand'. | ||
|
||
Gradle tasks are of group `docker` | ||
- updateDockerEnv | ||
- createDockerImage | ||
- startDockerContainer | ||
- stopDockerContainer |
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,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [[ $# -lt 1 ]]; then | ||
echo "Usage: ${0} [version] [project_dir]" | ||
exit 1 | ||
fi | ||
|
||
VERSION=${1} | ||
|
||
echo "CREATING CONTAINER FOR VERSION ${VERSION}" | ||
echo "Using project directory: ${2}" | ||
echo | ||
|
||
# run docker build | ||
echo "Building container:" | ||
docker buildx build --load -t "block-node-server:${1}" --build-context distributions=../build/distributions --build-arg VERSION="${VERSION}" . || exit "${?}" |
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,9 @@ | ||
version: '3.8' | ||
|
||
services: | ||
block-node-server: | ||
image: block-node-server:${VERSION} | ||
env_file: | ||
- .env | ||
ports: | ||
- "8080:8080" |
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,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This scripts create a '.env' file that is used for docker & docker-compose as an input of environment variables. | ||
# This script is called by gradle and get the current project version as an input param | ||
|
||
if [ $# -lt 1 ]; then | ||
echo "USAGE: $0 <VERSION>" | ||
exit 1 | ||
fi | ||
|
||
echo "VERSION=$1" > .env | ||
echo "REGISTRY_PREFIX=" >> .env | ||
# Storage root path, this is temporary until we have a proper .properties file for all configs | ||
echo "BLOCKNODE_STORAGE_ROOT_PATH=/app/storage" >> .env | ||
|
||
echo "VERSION/TAG UPDATED TO $1" |