-
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.
build container image based on unbase_oci (#10)
- Loading branch information
Showing
8 changed files
with
114 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,6 @@ out/ | |
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Unbase OCI ### | ||
*.oci |
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 @@ | ||
FROM sapmachine:21-jre-ubuntu | ||
|
||
RUN mkdir /opt/glvd | ||
COPY build/libs/glvd-0.0.1-SNAPSHOT.jar /opt/glvd/glvd.jar | ||
|
||
EXPOSE 8080 | ||
|
||
CMD ["java", "-jar", "/opt/glvd/glvd.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eufo pipefail | ||
|
||
if [[ ! -f build/libs/glvd-0.0.1-SNAPSHOT.jar ]]; then | ||
./gradlew bootJar | ||
fi | ||
|
||
podman build --tag ghcr.io/gardenlinux/glvd-api:edge . | ||
|
||
podman save --format oci-archive ghcr.io/gardenlinux/glvd-api:edge > glvd.oci | ||
|
||
podman pull ubuntu:22.04 | ||
podman save --format oci-archive ubuntu:22.04 > ubuntu.oci | ||
|
||
./unbase_oci --exclude exclude --include include --ldd-dependencies --print-tree ubuntu.oci glvd.oci glvd_bare.oci | ||
|
||
image="$(podman load < glvd_bare.oci | awk '{ print $NF }')" | ||
podman tag "$image" ghcr.io/gardenlinux/glvd-api:edge_bare |
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,3 @@ | ||
var/cache | ||
var/lib/apt | ||
var/log |
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 @@ | ||
tmp |
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,6 +1,6 @@ | ||
spring.application.name=glvd | ||
spring.datasource.url=jdbc:postgresql://localhost:5432/glvd | ||
spring.datasource.url=jdbc:postgresql://postgres:5432/glvd | ||
spring.datasource.username=glvd | ||
spring.datasource.password=glvd | ||
spring.sql.init.mode=never | ||
spring.jpa.properties.javax.persistence.query.timeout=5000 | ||
spring.jpa.properties.javax.persistence.query.timeout=5000 |
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,55 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eufo pipefail | ||
|
||
container_image=ghcr.io/gardenlinux/unbase_oci:233f4213036fadd4b91b965b4ca71b457f1a6b88 | ||
container_engine=podman | ||
|
||
container_mount_opts=() | ||
|
||
while [ $# -gt 0 ]; do | ||
case "$1" in | ||
--container-image) | ||
container_image="$2" | ||
shift 2 | ||
;; | ||
--container-engine) | ||
container_engine="$2" | ||
shift 2 | ||
;; | ||
--print-container-image) | ||
printf '%s\n' "$container_image" | ||
exit 0 | ||
;; | ||
*) | ||
break | ||
;; | ||
esac | ||
done | ||
|
||
args=() | ||
|
||
while [ $# -gt 0 ]; do | ||
case "$1" in | ||
-i|--include|-x|--exclude|--dpkg-include) | ||
container_mount_opts+=(-v "$(realpath "$2"):/mnt$(realpath "$2")") | ||
args+=("$1" "/mnt$(realpath "$2")") | ||
shift 2 | ||
;; | ||
--no-default-include|--no-default-exclude|-d|--dpkg-dependencies|-l|--ldd-dependencies|--print-tree) | ||
args+=("$1") | ||
shift | ||
;; | ||
*) | ||
break | ||
;; | ||
esac | ||
done | ||
|
||
container_mount_opts+=(-v "$(realpath "$1"):/mnt$(realpath "$1")") | ||
[ "$1" = "$2" ] || container_mount_opts+=(-v "$(realpath "$2"):/mnt$(realpath "$2")") | ||
[ -e "$3" ] || touch "$3" | ||
container_mount_opts+=(-v "$(realpath "$3"):/mnt$(realpath "$3")") | ||
args+=("/mnt$(realpath "$1")" "/mnt$(realpath "$2")" "/mnt$(realpath "$3")") | ||
|
||
"$container_engine" run --rm --read-only --tmpfs /tmp:rw,exec "${container_mount_opts[@]}" "$container_image" "${args[@]}" |