Docker build and publish image #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docker build and publish image | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 21 | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Build with Maven | |
| run: mvn -B package --file pom.xml -DskipTests=true | |
| - name: Publish to Registry | |
| env: | |
| DOCKER_USER: ${{secrets.DOCKER_USERNAME}} | |
| DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} | |
| run: | | |
| docker login -u $DOCKER_USER -p $DOCKER_PASSWORD | |
| - name: Build the Docker image | |
| run: docker build -t wlanboy/webshell:latest . --build-arg JAR_FILE=./target/webshell-0.1.2-SNAPSHOT.jar | |
| - name: Docker Push | |
| run: docker push wlanboy/webshell:latest |