Some checks failed
Docker Build and Push / build-and-push (push) Failing after 7s
33 lines
934 B
YAML
33 lines
934 B
YAML
name: Docker Build and Push
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- dev
|
|
|
|
jobs:
|
|
|
|
build-and-push:
|
|
runs-on: docker
|
|
image: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Build and push Docker image
|
|
env:
|
|
DOCKER_IMAGE_NAME: tibber-influx
|
|
run: |
|
|
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
|
|
DOCKER_TAG="latest"
|
|
elif [ "${{ github.ref }}" == "refs/heads/dev" ]; then
|
|
DOCKER_TAG="development"
|
|
else
|
|
DOCKER_TAG="other"
|
|
fi
|
|
echo ${{ secrets.DOCKER_TOKEN }} | docker login -u ${{ secrets.DOCKER_USER }} --password-stdin
|
|
docker build -t $DOCKER_IMAGE_NAME .
|
|
docker tag $DOCKER_IMAGE_NAME:latest ${{ secrets.DOCKER_USER }}/$DOCKER_IMAGE_NAME:$DOCKER_TAG
|
|
docker push ${{ secrets.DOCKER_USER }}/$DOCKER_IMAGE_NAME:$DOCKER_TAG
|