mirror of
https://github.com/PhoenixTwoFive/karaoqueue.git
synced 2025-05-18 18:41:48 +02:00
Add docker build and push script
This commit is contained in:
parent
c03f632ea0
commit
c87abb506d
@ -17,4 +17,7 @@ RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
|
|||||||
|
|
||||||
RUN pip install --no-cache-dir -U meinheld
|
RUN pip install --no-cache-dir -U meinheld
|
||||||
|
|
||||||
|
ARG SOURCE_VERSION
|
||||||
|
ENV SOURCE_VERSION ${SOURCE_VERSION:-unknown}
|
||||||
|
|
||||||
COPY ./backend /app
|
COPY ./backend /app
|
45
build_container.sh
Executable file
45
build_container.sh
Executable file
@ -0,0 +1,45 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Get username from command line
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
echo "No username supplied. Please supply a github username as the first argument."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Store username in variable
|
||||||
|
USERNAME=$1
|
||||||
|
|
||||||
|
# Check for uncommitted changes
|
||||||
|
if ! git diff-index --quiet HEAD --; then
|
||||||
|
echo "You have uncommitted changes. Please commit or stash them and try again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the user is logged into ghcr.io
|
||||||
|
if ! docker info | grep -q "Username: $USERNAME"; then
|
||||||
|
echo "You are not logged into ghcr.io. Please run 'docker login ghcr.io' and try again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the appropriate version of the container using git
|
||||||
|
VERSION=$(git rev-parse --abbrev-ref HEAD)-$(git describe)
|
||||||
|
|
||||||
|
# Build the container. Add the version as a tag and as ENV variable SOURCE_VERSION
|
||||||
|
docker build -t ghcr.io/$USERNAME/:$VERSION --build-arg SOURCE_VERSION=$VERSION .
|
||||||
|
|
||||||
|
# Ask the user if they want to push the container. Confirm Version.
|
||||||
|
read -p "Push container to ghcr.io/$USERNAME/karaoqueue:$VERSION? [y/n] " -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ $REPLY =~ ^[Yy]$ ]]
|
||||||
|
then
|
||||||
|
docker push ghcr.io/$USERNAME/karaoqueue:$VERSION
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ask the user if they want to push the container as latest
|
||||||
|
read -p "Push container to ghcr.io/$USERNAME/karaoqueue:latest? [y/n] " -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ $REPLY =~ ^[Yy]$ ]]
|
||||||
|
then
|
||||||
|
docker tag ghcr.io/$USERNAME/karaoqueue:$VERSION ghcr.io/$USERNAME/karaoqueue:latest
|
||||||
|
docker push ghcr.io/$USERNAME/karaoqueue:latest
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user