-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (33 loc) · 1.31 KB
/
prod.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Gestao de Vagas Application
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Build Project
run: mvn clean install
- name: Login docker
run: docker login -u ${{secrets.DOCKER_USERNAME}} -p ${{secrets.DOCKER_PASSWORD}}
- name: Build Docker Image
run: docker build -t luiseduardoalencar/gestao_vagas .
- name: Publish Image
run: docker push luiseduardoalencar/gestao_vagas
deploy:
needs: build
runs-on: self-hosted
steps:
- name: Pull image docker hub
run: docker pull luiseduardoalencar/gestao_vagas:latest
- name: remove container
run: docker rm -f
- name: Run docker container gestao-vagas
run: docker run -d -p 8080:8080 -e DATABASE_URL=${{secrets.DATABASE_URL}} -e DATABASE_PASSWORD=${{secrets.DATABASE_PASSWORD}} -e DATABASE_USERNAME=${{secrets.DATABASE_USERNAME}} --name gestao-vagas luiseduardoalencar/gestao_vagas