Skip to content

fix(cd): add port forwarding for server docker container 50505:8080 #14

fix(cd): add port forwarding for server docker container 50505:8080

fix(cd): add port forwarding for server docker container 50505:8080 #14

Workflow file for this run

name: CI
on: [ push ]
# [ ] Проверить зависимости при помощи OWASP Dependency Check
# 4. Собрать docker образ
# 5. Подключиться по SSH до dev.muse.kiryuxa.com
# 6. Поднять докер контейнер на порту + поменять реверс проксю чтобы перекидывало с dev.muse.kiryuxa.com -> localhost:59195
# Готово!
jobs:
linter:
runs-on: ubuntu-22.04
steps:
- name: Set up JDK 21 (Temurin)
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21.0'
- name: Checkout Code
uses: actions/checkout@v4
- name: Run linter
run: ./tools/scripts/runLinter.sh
static-analyzer:
runs-on: ubuntu-22.04
steps:
- name: Set up JDK 21 (Temurin)
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21.0'
- name: Checkout Code
uses: actions/checkout@v4
- name: Run static analyzer
run: ./tools/scripts/runStaticAnalyzer.sh
unit-tests:
runs-on: ubuntu-22.04
permissions:
contents: read
issues: read
checks: write
pull-requests: write
steps:
- name: Set up JDK 21 (Temurin)
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21.0'
- name: Checkout Code
uses: actions/checkout@v4
- name: Run Unit Tests
run: ./tools/scripts/runUnitTests.sh
- name: Publish Unit Test Results
if: always()
uses: EnricoMi/[email protected]
with:
files: ./**/**/build/test-results/**/*.xml
report_individual_runs: true
- name: Gather reports
uses: actions/upload-artifact@v2
if: always()
with:
name: reports
path: ./**/**/build/reports
deploy:
runs-on: ubuntu-22.04
needs: [ "linter", "static-analyzer", "unit-tests" ]
steps:
- name: Set up JDK 21 (Temurin)
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21.0'
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub via token
run: docker login -u myshx -p ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build Server Docker Image
run: |
./tools/scripts/buildJar.sh
docker build . -t myshx/muse-server:${{ github.sha }}
- name: Push Server Docker Image
run: docker push myshx/muse-server:${{ github.sha }}
- name: Run Server docker image at home lab
uses: appleboy/[email protected]
env:
COMMIT_SHA: ${{ github.sha }}
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
port: ${{ secrets.SERVER_PORT }}
envs: COMMIT_SHA
script: |
docker stop muse-server
docker rm muse-server
docker rmi muse-server
docker run "myshx/muse-server:$COMMIT_SHA" -p 50505:8080 -d