Add a script for building and publishing
This commit is contained in:
parent
316969c5eb
commit
f74e3831fe
18
README.md
18
README.md
@ -1,3 +1,21 @@
|
||||
# mixtape-build-image
|
||||
|
||||
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
24
build.sh
Executable 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"
|
Loading…
Reference in New Issue
Block a user