perf: improving performance, layout (#215)
Co-authored-by: nullishamy <git@amyerskine.me>
This commit is contained in:
14
docker/Dockerfile
Normal file
14
docker/Dockerfile
Normal file
@@ -0,0 +1,14 @@
|
||||
# This dockerfile generates a container with the needed dependencies to build the theme
|
||||
|
||||
FROM python:alpine
|
||||
|
||||
RUN apk add sassc inkscape optipng
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt .
|
||||
|
||||
RUN pip install --no-cache-dir -r requirements.txt && rm requirements.txt
|
||||
|
||||
# The reason for this is to allow the GH Actions Workflow execute commands within the container
|
||||
CMD ["sleep", "infinity"]
|
||||
83
docker/build.sh
Normal file
83
docker/build.sh
Normal file
@@ -0,0 +1,83 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Default value for custom_version
|
||||
VERSION="no"
|
||||
|
||||
while getopts v:h opt 2>/dev/null; do
|
||||
case "$opt" in
|
||||
v)
|
||||
VERSION=$OPTARG
|
||||
;;
|
||||
h)
|
||||
echo "\
|
||||
Usage: $0 [-v <version>]
|
||||
|
||||
Push script for Catppuccin's GTK docker build image
|
||||
|
||||
-v Custom version to build the image (<your-image-name>:<version>)
|
||||
If you only want to generate the image with tag 'latest' use '-v no'
|
||||
-h Print this help text" >&2
|
||||
exit 0
|
||||
;;
|
||||
?)
|
||||
echo "Usage: $0 [-h]" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
echo "Usage: $0 [-h]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Resolve the absolute path of the script without readlink
|
||||
SCRIPT_PATH="$0"
|
||||
|
||||
# Check if SCRIPT_PATH is a symbolic link
|
||||
while [ -h "$SCRIPT_PATH" ]; do
|
||||
LS=$(ls -ld "$SCRIPT_PATH")
|
||||
LINK=$(expr "$LS" : '.*-> \(.*\)$')
|
||||
if expr "$LINK" : '/.*' > /dev/null; then
|
||||
SCRIPT_PATH="$LINK"
|
||||
else
|
||||
SCRIPT_PATH=$(dirname "$SCRIPT_PATH")/"$LINK"
|
||||
fi
|
||||
done
|
||||
|
||||
# Ensure we have an absolute path
|
||||
case "$SCRIPT_PATH" in
|
||||
/*) ;;
|
||||
*) SCRIPT_PATH="$(pwd)/$SCRIPT_PATH" ;;
|
||||
esac
|
||||
|
||||
# Path to script' dir
|
||||
SCRIPT_DIR=$(cd "$(dirname "$SCRIPT_PATH")" && pwd)
|
||||
|
||||
# Path to the Dockerfile
|
||||
DOCKERFILE_PATH="$SCRIPT_DIR/Dockerfile"
|
||||
|
||||
# Docker variables
|
||||
IMAGE_NAME="ghcr.io/catppuccin/gtk"
|
||||
|
||||
# Detect podman
|
||||
if command -v podman > /dev/null 2>&1; then
|
||||
CONTAINER_TOOL="podman"
|
||||
elif command -v docker > /dev/null 2>&1; then
|
||||
CONTAINER_TOOL="docker"
|
||||
else
|
||||
echo "Error: Neither podman nor docker is installed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Clean previous generated images
|
||||
$CONTAINER_TOOL image rm "$IMAGE_NAME:latest" 2> /dev/null
|
||||
$CONTAINER_TOOL image rm "$IMAGE_NAME:$VERSION" 2> /dev/null
|
||||
|
||||
# Build the Docker image with latest tag
|
||||
$CONTAINER_TOOL build -t "$IMAGE_NAME:latest" -f "$DOCKERFILE_PATH" "$SCRIPT_DIR/.."
|
||||
|
||||
# Execute docker tag command if VERSION is not "no"
|
||||
if [ "$VERSION" != "no" ]; then
|
||||
$CONTAINER_TOOL tag "$IMAGE_NAME:latest" "$IMAGE_NAME:$VERSION"
|
||||
fi
|
||||
66
docker/push.sh
Normal file
66
docker/push.sh
Normal file
@@ -0,0 +1,66 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Default value for parameters
|
||||
VERSION="no"
|
||||
USERNAME="no"
|
||||
PASSWORD="no"
|
||||
|
||||
while getopts u:p:v:h opt 2>/dev/null; do
|
||||
case "$opt" in
|
||||
v)
|
||||
VERSION=$OPTARG
|
||||
;;
|
||||
u)
|
||||
USERNAME=$OPTARG
|
||||
;;
|
||||
p)
|
||||
PASSWORD=$OPTARG
|
||||
;;
|
||||
h)
|
||||
echo "\
|
||||
Usage: $0 [-v <version> | -u [your-github-username] | -p [your-github-password]]
|
||||
|
||||
Push script for Catppuccin's GTK docker build image
|
||||
|
||||
-v Custom version to push the image (<your-image-name>:<version>)
|
||||
-u Your GitHub username that will be used to log into GHCR
|
||||
-p Your GitHub password that will be used to log into GHCR
|
||||
-h Print this help text" >&2
|
||||
exit 0
|
||||
;;
|
||||
?)
|
||||
echo "Usage: $0 [-h]" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
echo "Usage: $0 [-h]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Detect podman
|
||||
if command -v podman > /dev/null 2>&1; then
|
||||
CONTAINER_TOOL="podman"
|
||||
elif command -v docker > /dev/null 2>&1; then
|
||||
CONTAINER_TOOL="docker"
|
||||
else
|
||||
echo "Error: Neither podman nor docker is installed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Docker variables
|
||||
IMAGE_NAME="ghcr.io/catppuccin/gtk"
|
||||
|
||||
# Log into ghcr
|
||||
$CONTAINER_TOOL login ghcr.io -u $USERNAME --password $PASSWORD
|
||||
|
||||
# Push docker image with latest tag
|
||||
$CONTAINER_TOOL push "$IMAGE_NAME:latest"
|
||||
|
||||
# Execute docker push for specific version if VERSION is not "no"
|
||||
if [ "$VERSION" != "no" ]; then
|
||||
$CONTAINER_TOOL push "$IMAGE_NAME:$VERSION"
|
||||
fi
|
||||
Reference in New Issue
Block a user