Add explicit Forgejo deployment structure with artifact build pipeline
- Introduce clear directory separation for docker, infra, ci, and config - Add CloudFormation pipeline for S3 → CodeBuild → ECR - Implement explicit artifact build script for flat deployment zip - Provide example runtime configuration and ignore secrets
This commit is contained in:
commit
46ec47aa2d
8 changed files with 323 additions and 0 deletions
50
docker/entrypoint.sh
Executable file
50
docker/entrypoint.sh
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Define the target configuration file path where Forgejo (or Gitea) expects it.
|
||||
CONFIG_DIR="/var/lib/gitea/custom/conf"
|
||||
CONFIG_FILE="${CONFIG_DIR}/app.ini"
|
||||
|
||||
# Define the path to the default configuration file bundled in the image.
|
||||
DEFAULT_CONFIG="/defaults/app.ini"
|
||||
|
||||
# Read the optional environment variable to force the configuration update.
|
||||
# Set FORCE_COPY_APP_CONF=true to force overwriting the configuration file.
|
||||
FORCE_COPY=${FORCE_COPY_APP_CONF:-false}
|
||||
|
||||
echo "Starting container initialization..."
|
||||
|
||||
# If the force option is enabled, remove the existing configuration file (if any)
|
||||
if [ "$FORCE_COPY" = "true" ]; then
|
||||
echo "Force option enabled. Removing any existing configuration file at ${CONFIG_FILE}..."
|
||||
rm -f "$CONFIG_FILE"
|
||||
fi
|
||||
|
||||
# If the configuration file does not exist, prepopulate it from the default copy.
|
||||
if [ ! -f "$CONFIG_FILE" ]; then
|
||||
echo "Configuration file not found at ${CONFIG_FILE}."
|
||||
echo "Prepopulating the EFS volume with the default configuration."
|
||||
|
||||
# Make sure the configuration directory exists.
|
||||
mkdir -p "$CONFIG_DIR"
|
||||
|
||||
# Copy the default configuration file into the mounted volume.
|
||||
cp "$DEFAULT_CONFIG" "$CONFIG_FILE"
|
||||
|
||||
# Set proper ownership and permissions.
|
||||
# Replace '1000:1000' with the UID:GID used by Forgejo if different.
|
||||
chown 1000:1000 "$CONFIG_FILE"
|
||||
chmod 644 "$CONFIG_FILE"
|
||||
|
||||
echo "Prepopulation complete. Configuration is now available at ${CONFIG_FILE}."
|
||||
else
|
||||
echo "Configuration file already exists at ${CONFIG_FILE}. Skipping prepopulation."
|
||||
fi
|
||||
|
||||
# Optionally, log the first few lines of the configuration file for verification.
|
||||
echo "Current configuration (first few lines):"
|
||||
head -n 10 "$CONFIG_FILE"
|
||||
|
||||
# Hand over execution to the original entrypoint.
|
||||
# The official Forgejo image typically uses the entrypoint at '/usr/local/bin/docker-entrypoint.sh'
|
||||
exec /usr/local/bin/docker-entrypoint.sh "$@"
|
||||
Loading…
Add table
Add a link
Reference in a new issue