34 lines
804 B
YAML
34 lines
804 B
YAML
name: Build and Deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build with Maven
|
|
run: |
|
|
apt-get update -qq && apt-get install -y -qq maven 2>/dev/null || true
|
|
mvn clean install -Dmaven.test.skip=true
|
|
|
|
- name: Build Docker image
|
|
run: docker build -t auth-backend:latest .
|
|
|
|
- name: Deploy
|
|
run: |
|
|
docker stop auth-backend-container || true
|
|
docker rm auth-backend-container || true
|
|
docker run -d \
|
|
--name auth-backend-container \
|
|
--network nginx \
|
|
-p 9001:9001 \
|
|
--restart unless-stopped \
|
|
auth-backend:latest
|