Skip to content

Configuring the Build Environment #61

Configuring the Build Environment

Configuring the Build Environment #61

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
DOCKER_USER: a002k
DOCKER_IMAGE: simple-app
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: oracle
java-version: 22
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: '8.10.2'
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build and analyze
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: gradle build jacocoAggregatedReport sonar --info
- name: Login to Docker Hub
run: docker login -u ${{ DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}

Check failure on line 45 in .github/workflows/actions.yml

View workflow run for this annotation

GitHub Actions / Docker Image CI

Invalid workflow file

The workflow is not valid. .github/workflows/actions.yml (Line: 45, Col: 14): Unrecognized named-value: 'DOCKER_USER'. Located at position 1 within expression: DOCKER_USER .github/workflows/actions.yml (Line: 47, Col: 14): Unrecognized named-value: 'DOCKER_USER'. Located at position 1 within expression: DOCKER_USER
- name: Build and tag the Docker image
run: |
docker build -t ${{ DOCKER_USER }}/${{ DOCKER_IMAGE }}:latest .
- name: Push the Docker image
run: docker push ${{ DOCKER_USER }}/${{ DOCKER_IMAGE }} --all-tags