Files
haproxy/.gitea/workflows/build.yaml
T
bitdeals c063688b75
Build docker image and push to registry.bitdeals.org / main-build-job (push) Successful in 44s
ci: pass the registry password on stdin, fail on a failed push
A password in argv is world-readable through /proc/PID/cmdline while the
command runs; docker warns about it for that reason. The environment of a
process is readable by its owner alone, so $PASS itself was never the problem.

The two pushes are joined with && rather than left as separate statements: the
step's exit code is the last command's, so the intent is now explicit instead
of resting on whatever -e flag the runner's shell happens to carry.
2026-08-07 13:38:54 +00:00

40 lines
1.2 KiB
YAML

name: Build docker image and push to registry.bitdeals.org
run-name: docker build and docker push
on:
push:
branches:
- main
- master
schedule:
- cron: '20 10 * * *'
jobs:
main-build-job:
runs-on: ubuntu-latest
env:
VERSION: 1.0
COMMIT: ${{ gitea.sha }}
REPOSITORY: ${{ gitea.repository }}
#registry.bitdeals.org
REGISTRY: 10.0.3.111:5000
USER: ${{ secrets.DOCKER_USERNAME }}
PASS: ${{ secrets.DOCKER_PASSWORD }}
steps:
- name: Checkout repository code
uses: actions/checkout@v6
- name: Build docker app image
run: |
docker build . \
--file "$(find ./Dockerfile ./docker/Dockerfile -print -quit 2>/dev/null)" \
--label "git-commit=$COMMIT" \
--tag "${REGISTRY}/${REPOSITORY##*/}:${VERSION}.${COMMIT::7}" \
--tag "${REGISTRY}/${REPOSITORY##*/}:latest"
- name: Docker login
run: |
echo "$PASS" | docker login --username "$USER" --password-stdin "$REGISTRY"
- name: Push images to registry
run: |
docker push "${REGISTRY}/${REPOSITORY##*/}:${VERSION}.${COMMIT::7}" && \
docker push "${REGISTRY}/${REPOSITORY##*/}:latest"