forked from vacaramin/Virtual-Horizon
-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (40 loc) · 1.76 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
name: Build and Push Docker Compose for Production
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up environment
run: |
echo "PORT=${{ secrets.PORT }}" >> backend/.env
echo "DB=${{ secrets.DB }}" >> backend/.env
echo "SECRET=${{ secrets.SECRET }}" >> backend/.env
echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> backend/.env
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Build and Push Docker Compose for Backend
run: |
version="v1.$GITHUB_RUN_NUMBER"
docker-compose -f docker-compose-ci.yaml build backend
docker tag virtual-horizon_backend:latest vacaramin/virtual-horizon-backend:$version
docker tag virtual-horizon_backend:latest vacaramin/virtual-horizon-backend:latest
docker push vacaramin/virtual-horizon-backend:$version
docker push vacaramin/virtual-horizon-backend:latest
- name: Build and Push Docker Compose for Frontend
run: |
version="v1.$GITHUB_RUN_NUMBER"
docker-compose -f docker-compose-ci.yaml build frontend
docker tag virtual-horizon_frontend:latest vacaramin/virtual-horizon-frontend:$version
docker tag virtual-horizon_frontend:latest vacaramin/virtual-horizon-frontend:latest
docker push vacaramin/virtual-horizon-frontend:$version
docker push vacaramin/virtual-horizon-frontend:latest