-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (44 loc) · 1.26 KB
/
docker-image.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Docker Image CI
on:
push:
branches: [ "main" ]
paths:
- 'app/**'
pull_request:
branches: [ "main" ]
paths:
- 'app/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: |
cd app
docker build -t dominikmatic/my_website:latest .
- name: Log into dockerhub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Push the Docker image
run: docker push dominikmatic/my_website:latest
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run ansible playbook
uses: dawidd6/action-ansible-playbook@v2
with:
# Required, playbook filepath
playbook: ansible/deploy.yml
# Optional, SSH private key
key: ${{secrets.ANSIBLE_PRIVATE_KEY}}
# Optional, literal inventory file contents
inventory: |
[web_servers]
3.73.187.39
# Optional, SSH known hosts file content
known_hosts: |
3.73.187.39 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFPYJDOesJo7cyobs6S4mjhhud13BpmG0GnLZ/Q8yf7Y
options: |
-u ansible