added DB_NAME env variable and added gitea workflow to publish the container
Some checks failed
Build, Secure, and Push Docker Image on Release / build-and-push (release) Failing after 6s
Some checks failed
Build, Secure, and Push Docker Image on Release / build-and-push (release) Failing after 6s
This commit is contained in:
parent
6b73961808
commit
8be0ce82f6
49
.gitea/workflows/publish-containers.yaml
Normal file
49
.gitea/workflows/publish-containers.yaml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
name: Build, Secure, and Push Docker Image on Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published, prereleased]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKER_IMAGE_NAME: docker.io/openharbor/odoo
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Log in to DockerHub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
- name: Determine Tag Type
|
||||||
|
id: tag_type
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
|
||||||
|
echo "tag=dev" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "tag=latest" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Build, push, and generate SBOM and provenance
|
||||||
|
run: |
|
||||||
|
docker buildx build \
|
||||||
|
--provenance=true \
|
||||||
|
--sbom=true \
|
||||||
|
--push \
|
||||||
|
-t ${{ env.DOCKER_IMAGE_NAME }}:${{ github.event.release.tag_name }} \
|
||||||
|
-t ${{ env.DOCKER_IMAGE_NAME }}:${{ env.tag }} \
|
||||||
|
.
|
@ -12,6 +12,7 @@ fi
|
|||||||
: ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}}
|
: ${PORT:=${DB_PORT_5432_TCP_PORT:=5432}}
|
||||||
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
|
: ${USER:=${DB_ENV_POSTGRES_USER:=${POSTGRES_USER:='odoo'}}}
|
||||||
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}
|
: ${PASSWORD:=${DB_ENV_POSTGRES_PASSWORD:=${POSTGRES_PASSWORD:='odoo'}}}
|
||||||
|
: ${DB_NAME:=${DB_ENV_POSTGRES_DB_NAME:=${POSTGRES_DB_NAME:='odoo'}}}
|
||||||
|
|
||||||
DB_ARGS=()
|
DB_ARGS=()
|
||||||
function check_config() {
|
function check_config() {
|
||||||
@ -27,6 +28,7 @@ check_config "db_host" "$HOST"
|
|||||||
check_config "db_port" "$PORT"
|
check_config "db_port" "$PORT"
|
||||||
check_config "db_user" "$USER"
|
check_config "db_user" "$USER"
|
||||||
check_config "db_password" "$PASSWORD"
|
check_config "db_password" "$PASSWORD"
|
||||||
|
check_config "db_name" "$DB_NAME"
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-- | odoo)
|
-- | odoo)
|
||||||
|
@ -9,6 +9,7 @@ if __name__ == '__main__':
|
|||||||
arg_parser = argparse.ArgumentParser()
|
arg_parser = argparse.ArgumentParser()
|
||||||
arg_parser.add_argument('--db_host', required=True)
|
arg_parser.add_argument('--db_host', required=True)
|
||||||
arg_parser.add_argument('--db_port', required=True)
|
arg_parser.add_argument('--db_port', required=True)
|
||||||
|
arg_parser.add_argument('--db_name', required=True)
|
||||||
arg_parser.add_argument('--db_user', required=True)
|
arg_parser.add_argument('--db_user', required=True)
|
||||||
arg_parser.add_argument('--db_password', required=True)
|
arg_parser.add_argument('--db_password', required=True)
|
||||||
arg_parser.add_argument('--timeout', type=int, default=5)
|
arg_parser.add_argument('--timeout', type=int, default=5)
|
||||||
@ -18,7 +19,7 @@ if __name__ == '__main__':
|
|||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
while (time.time() - start_time) < args.timeout:
|
while (time.time() - start_time) < args.timeout:
|
||||||
try:
|
try:
|
||||||
conn = psycopg2.connect(user=args.db_user, host=args.db_host, port=args.db_port, password=args.db_password, dbname='postgres')
|
conn = psycopg2.connect(user=args.db_user, host=args.db_host, port=args.db_port, password=args.db_password, dbname=args.db_name)
|
||||||
error = ''
|
error = ''
|
||||||
break
|
break
|
||||||
except psycopg2.OperationalError as e:
|
except psycopg2.OperationalError as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user