-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (51 loc) · 2.62 KB
/
Copy pathdocker-image.yml
File metadata and controls
61 lines (51 loc) · 2.62 KB
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
53
54
55
56
57
58
59
60
61
name: Docker Image CI
on:
workflow_dispatch:
push:
branches: ["master"]
# Environment variables available to all jobs and steps in this workflow
env:
ENVIRONMENT: production
IP_BACKEND: "backend-service" # values.yaml>backendServiceName
SERVER_PORT: 3500 # values.yaml>backendContainerPort
IP_FRONTEND: "frontend-service" # values.yaml>backendContainerPort
INNER_PORT_FRONTEND: 80
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Checkout GitHub Action"
uses: actions/checkout@main
- name: "Login via Azure CLI"
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: "Docker Auhentication"
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: "Build and Push Redis Image"
run: |
docker build -f services/redis/Dockerfile -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/realtimepixel_redis:${{ github.sha }} --target ${{env.ENVIRONMENT}} --build-arg NODE_ENV=${{env.ENVIRONMENT}} .
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/realtimepixel_redis:${{ github.sha }}
- name: "Build and Push Backend Image"
run: |
docker build -f services/backend/Dockerfile -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/realtimepixel_backend:${{ github.sha }} --target ${{env.ENVIRONMENT}} --build-arg NODE_ENV=${{env.ENVIRONMENT}} .
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/realtimepixel_backend:${{ github.sha }}
- name: "Build and Push Frontend Image"
run: |
docker build -f services/frontend/Dockerfile -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/realtimepixel_frontend:${{ github.sha }} --target ${{env.ENVIRONMENT}} --build-arg NODE_ENV=${{env.ENVIRONMENT}} .
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/realtimepixel_frontend:${{ github.sha }}
# - name: "Deploy to Azure Container Instances: Backend"
# uses: "azure/aci-deploy@v1"
# with:
# resource-group: ${{ secrets.RESOURCE_GROUP }}
# dns-name-label: ${{ secrets.RESOURCE_GROUP }}${{ github.run_number }}
# image: ${{ secrets.REGISTRY_LOGIN_SERVER }}/sampleapp:${{ github.sha }}
# registry-login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
# registry-username: ${{ secrets.AZURE_CLIENT_ID }}
# registry-password: ${{ secrets.AZURE_SECRET_ID }}
# name: realtimepixel
# location: "west us"