Add a script for building and publishing

This commit is contained in:
Emil Miler 2024-10-01 18:16:05 +02:00
parent 316969c5eb
commit f74e3831fe
2 changed files with 43 additions and 1 deletions

View File

@ -1,3 +1,21 @@
# mixtape-build-image # mixtape-build-image
Docker container ready for building my mixtape. Docker container ready for building my mixtape.
## Building
```
docker build .
```
Build and tag for release:
```
docker build -t git.0x45.cz/em/mixtape:$(date +%y%m%d) -t git.0x45.cz/em/mixtape:latest .
```
Using the included build script, which will also handle the publishing:
```
./build.sh
```

24
build.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
set -e
logout() {
docker logout "$GIT_ADDRESS"
}
trap logout EXIT
GIT_ADDRESS="git.0x45.cz"
IMAGE_NAME="$GIT_ADDRESS/em/mixtape"
DATE_TAG=$(date +%y%m%d)
docker build -t "${IMAGE_NAME}:${DATE_TAG}" -t "${IMAGE_NAME}:latest" .
read -rp "Enter your ${GIT_ADDRESS} username: " USERNAME
read -rsp "Enter your ${GIT_ADDRESS} password: " PASSWORD
echo
echo "$PASSWORD" | docker login -u "$USERNAME" "$GIT_ADDRESS" --password-stdin
docker push "${IMAGE_NAME}:${DATE_TAG}"
docker push "${IMAGE_NAME}:latest"