-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Use buildpacks for better caching
- Loading branch information
1 parent
59df567
commit ae6553b
Showing
83 changed files
with
970 additions
and
612 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
|
||
FROM python:3.11-bookworm | ||
|
||
|
||
SHELL ["/bin/bash", "-euo", "pipefail", "-c"] | ||
ENV SHELL=/bin/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Define the base image | ||
ARG BASE_IMAGE=debian:bookworm-slim | ||
FROM $BASE_IMAGE | ||
|
||
USER root | ||
|
||
# Install packages that we want to make available at build time | ||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
xz-utils \ | ||
ca-certificates \ | ||
rsync \ | ||
python3 \ | ||
python3-pip \ | ||
python3-venv && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Set required CNB user information | ||
ARG CNB_USER_ID=1000 | ||
ARG CNB_GROUP_ID=1000 | ||
ENV CNB_USER_ID=${CNB_USER_ID} | ||
ENV CNB_GROUP_ID=${CNB_GROUP_ID} | ||
|
||
# Create user and group | ||
RUN groupadd cnb --gid ${CNB_GROUP_ID} && \ | ||
useradd -l --uid ${CNB_USER_ID} --gid ${CNB_GROUP_ID} -m -s /bin/bash cnb | ||
|
||
RUN ln -s "$(which python3.11)" /usr/bin/python && \ | ||
ln -sf "$(which python3.11)" /usr/bin/python3 && \ | ||
ln -sf "$(which pip3.11)" /usr/local/bin/pip && \ | ||
ln -sf "$(which pip3.11)" /usr/local/bin/pip3 && \ | ||
pip install --break-system-packages --no-cache-dir pre-commit lxml PyYAML | ||
|
||
# Set user and group | ||
USER ${CNB_USER_ID}:${CNB_GROUP_ID} |
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,62 @@ | ||
# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
[[buildpacks]] | ||
uri = "../buildpacks/capella" | ||
|
||
[[buildpacks]] | ||
uri = "../buildpacks/capella-dropins" | ||
|
||
[[buildpacks]] | ||
uri = "../buildpacks/t4c" | ||
|
||
[[buildpacks]] | ||
uri = "../buildpacks/supervisord" | ||
|
||
[[buildpacks]] | ||
uri = "../buildpacks/xpra" | ||
|
||
[[buildpacks]] | ||
uri = "../buildpacks/xrdp" | ||
|
||
[[buildpacks]] | ||
uri = "../buildpacks/xidletime" | ||
|
||
[[extensions]] | ||
uri = "../extensions/capella-deps" | ||
|
||
[[extensions]] | ||
uri = "../extensions/xpra-deps" | ||
|
||
[[extensions]] | ||
|
||
uri = "../extensions/xrdp-deps" | ||
|
||
[[extensions]] | ||
uri = "../extensions/xidletime-deps" | ||
|
||
[[order]] | ||
group = [ | ||
{ id = "capella", version = "0.0.0" }, | ||
{ id = "capella-dropins", version = "0.0.0" }, | ||
{ id = "t4c", version = "0.0.0", optional = true }, | ||
{ id = "supervisord", version = "0.0.0", optional = true }, | ||
{ id = "xpra", version = "0.0.0", optional = true }, | ||
{ id = "xrdp", version = "0.0.0", optional = true }, | ||
{ id = "xidletime", version = "0.0.0", optional = true }, | ||
] | ||
|
||
[[order-extensions]] | ||
group = [ | ||
{ id = "capella-deps", version = "0.0.0" }, | ||
{ id = "xpra-deps", version = "0.0.0", optional = true }, | ||
{ id = "xrdp-deps", version = "0.0.0", optional = true }, | ||
{ id = "xidletime-deps", version = "0.0.0", optional = true }, | ||
] | ||
|
||
[build] | ||
image = "buildpacks-base" | ||
[run] | ||
[[run.images]] | ||
image = "base" | ||
mirrors = ["localhost:12345/base"] |
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,24 @@ | ||
#!/usr/bin/env bash | ||
# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -eo pipefail | ||
|
||
mkdir -p ${CNB_LAYERS_DIR}/app | ||
cp -r /app/capella/versions/${CAPELLA_VERSION}/dropins/* ${CNB_LAYERS_DIR}/app/ | ||
|
||
# In case someone had dropins in their archive, copy it to the dropins layer | ||
if [ -n "$(ls -A /layers/capella/app/dropins 2>/dev/null)" ]; then | ||
cp -r "/layers/capella/app/dropins/"* ${CNB_LAYERS_DIR}/app/ | ||
fi | ||
|
||
# Replace dropins folder with symbolic link to dropins layer | ||
rm -rf /layers/capella/app/dropins | ||
ln -s ${CNB_LAYERS_DIR}/app /layers/capella/app/dropins | ||
|
||
python3 /app/buildpacks/buildpacks/capella-dropins/install_dropins.py | ||
|
||
cat > "${CNB_LAYERS_DIR}/app.toml" << EOL | ||
[types] | ||
launch = true | ||
EOL |
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 @@ | ||
#!/usr/bin/env bash | ||
# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -eo pipefail | ||
|
||
# Don't cache if capella layer has changed. The symlink has to be updated! | ||
|
||
# Otherwise cache if hash of dropins has not changed. |
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,11 @@ | ||
# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
api = "0.11" | ||
|
||
[buildpack] | ||
id = "capella-dropins" | ||
version = "0.0.0" | ||
|
||
[[targets]] | ||
os = "linux" |
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,17 @@ | ||
#!/bin/bash | ||
# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Autostart script | ||
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | ||
|
||
if [ "$AUTOSTART_CAPELLA" = "1" ]; | ||
then | ||
if [ "$RESTART_CAPELLA" = "1" ]; | ||
then | ||
# Run capella in a loop: | ||
( while true; do /layers/capella/app/capella -data ${WORKSPACE_DIR:-/workspace} > /var/log/capella.stdout.log 2> /var/log/capella.stderr.log; sleep 1; done ) & | ||
else | ||
/layers/capella/app/capella -data ${WORKSPACE_DIR:-/workspace} > /var/log/capella.stdout.log 2> /var/log/capella.stderr.log & | ||
fi | ||
fi |
Oops, something went wrong.