mirror of
https://github.com/esauflores/databases.git
synced 2026-03-09 06:30:34 +00:00
feat: updated structure for build and push in Justfile
This commit is contained in:
9
.github/workflows/test-and-push.yml
vendored
9
.github/workflows/test-and-push.yml
vendored
@@ -33,6 +33,7 @@ jobs:
|
|||||||
|
|
||||||
publish:
|
publish:
|
||||||
needs: test
|
needs: test
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
@@ -55,7 +56,13 @@ jobs:
|
|||||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
- name: Push ${{ matrix.db }}
|
- name: Push ${{ matrix.db }}
|
||||||
run: just push ${{ matrix.db }}
|
run: just push ${{ matrix.db }} ${{ env.VERSION }}
|
||||||
|
|
||||||
|
- name: Push latest ${{ matrix.db }}
|
||||||
|
run: just push ${{ matrix.db }} latest
|
||||||
|
|
||||||
- name: Cleanup ${{ matrix.db }}
|
- name: Cleanup ${{ matrix.db }}
|
||||||
run: just clean ${{ matrix.db }}
|
run: just clean ${{ matrix.db }}
|
||||||
|
|
||||||
|
- name: Cleanup images ${{ matrix.db }}
|
||||||
|
run: just clean-images ${{ matrix.db }}
|
||||||
|
|||||||
33
Justfile
33
Justfile
@@ -27,35 +27,34 @@ down db=VARIANT:
|
|||||||
clean db=VARIANT:
|
clean db=VARIANT:
|
||||||
docker compose -f {{db}}/compose.yml down -v
|
docker compose -f {{db}}/compose.yml down -v
|
||||||
|
|
||||||
|
# Remove the database image from local Docker cache
|
||||||
|
clean-images db=VARIANT:
|
||||||
|
docker compose -f {{db}}/compose.yml down --rmi local
|
||||||
|
|
||||||
### Build & Publish ###
|
### Build & Publish ###
|
||||||
|
|
||||||
# Build image locally
|
# Build image locally
|
||||||
build db=VARIANT:
|
build db=VARIANT:
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
PREFIX=${REGISTRY_URL:+${REGISTRY_URL}/}
|
IMAGE="database-{{db}}:latest"
|
||||||
IMAGE="database-{{db}}:{{VERSION}}"
|
echo "docker build -f {{db}}/Dockerfile -t ${IMAGE} {{db}}"
|
||||||
|
docker build -f {{db}}/Dockerfile -t ${IMAGE} {{db}}
|
||||||
echo "docker build -f {{db}}/Dockerfile -t ${PREFIX}${IMAGE} {{db}}"
|
|
||||||
docker build -f {{db}}/Dockerfile -t ${PREFIX}${IMAGE} {{db}}
|
|
||||||
|
|
||||||
# Build and push image to registry
|
# Build and push image to registry
|
||||||
push db=VARIANT:
|
push db=VARIANT version=VERSION:
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
REGISTRY_URL='{{REGISTRY_URL}}'
|
||||||
PREFIX=${REGISTRY_URL:+${REGISTRY_URL}/}
|
PREFIX=${REGISTRY_URL:+${REGISTRY_URL}/}
|
||||||
IMAGE="database-{{db}}:{{VERSION}}"
|
IMAGE="database-{{db}}"
|
||||||
|
VERSION={{version}}
|
||||||
|
|
||||||
just build {{db}}
|
just build {{db}}
|
||||||
echo "docker push ${PREFIX}${IMAGE}"
|
|
||||||
docker push ${PREFIX}${IMAGE}
|
|
||||||
|
|
||||||
push-latest db=VARIANT:
|
echo "docker tag ${IMAGE}:latest ${PREFIX}${IMAGE}:${VERSION}"
|
||||||
#!/usr/bin/env bash
|
docker tag ${IMAGE}:latest ${PREFIX}${IMAGE}:${VERSION}
|
||||||
PREFIX=${REGISTRY_URL:+${REGISTRY_URL}/}
|
|
||||||
IMAGE="database-{{db}}:latest"
|
|
||||||
|
|
||||||
just build {{db}}
|
echo "docker push ${PREFIX}${IMAGE}:${VERSION}"
|
||||||
echo "docker push ${PREFIX}${IMAGE}"
|
docker push ${PREFIX}${IMAGE}:${VERSION}
|
||||||
docker push ${PREFIX}${IMAGE}
|
|
||||||
|
|
||||||
### Tests ###
|
### Tests ###
|
||||||
|
|
||||||
@@ -70,4 +69,4 @@ test db=VARIANT:
|
|||||||
_test-postgres:
|
_test-postgres:
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
just up postgres
|
just up postgres
|
||||||
docker compose -f postgres/compose.yml exec postgres pg_isready -U ${POSTGRES_USER}
|
docker compose -f postgres/compose.yml exec postgres pg_isready -U ${POSTGRES_USER:-postgres}
|
||||||
|
|||||||
Reference in New Issue
Block a user