@@ -1,63 +1,26 @@
|
|||||||
name: Deploy
|
services:
|
||||||
|
app:
|
||||||
|
build: .
|
||||||
|
image: registry.infra.mintel.me/mintel/mb-grid-solutions:latest
|
||||||
|
restart: always
|
||||||
|
expose:
|
||||||
|
- "3000"
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.mb-grid-solutions.rule=Host(`mb-grid-solutions.com`, `www.mb-grid-solutions.com`)"
|
||||||
|
- "traefik.http.routers.mb-grid-solutions.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.mb-grid-solutions.tls.certresolver=le"
|
||||||
|
- "traefik.http.services.mb-grid-solutions.loadbalancer.server.port=3000"
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "wget", "-q", "-O", "-", "http://localhost:3000/health"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 2s
|
||||||
|
retries: 10
|
||||||
|
deploy:
|
||||||
|
replicas: 2
|
||||||
|
networks:
|
||||||
|
- alpha
|
||||||
|
|
||||||
on:
|
networks:
|
||||||
push:
|
alpha:
|
||||||
branches:
|
external: true
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
deploy:
|
|
||||||
runs-on: docker
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Debug workspace
|
|
||||||
run: |
|
|
||||||
echo "PWD:"
|
|
||||||
pwd
|
|
||||||
echo "Workspace tree:"
|
|
||||||
find /workspace -maxdepth 3 -type f
|
|
||||||
|
|
||||||
- name: Install tools
|
|
||||||
run: |
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y docker.io openssh-client rsync
|
|
||||||
|
|
||||||
- name: Login to registry
|
|
||||||
env:
|
|
||||||
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
|
||||||
REGISTRY_PASS: ${{ secrets.REGISTRY_PASS }}
|
|
||||||
run: |
|
|
||||||
echo "$REGISTRY_PASS" | docker login registry.infra.mintel.me -u "$REGISTRY_USER" --password-stdin
|
|
||||||
|
|
||||||
- name: Build image
|
|
||||||
run: |
|
|
||||||
cd "$GITHUB_WORKSPACE"
|
|
||||||
docker build -t registry.infra.mintel.me/mintel/mb-grid-solutions:latest .
|
|
||||||
|
|
||||||
- name: Push image
|
|
||||||
run: |
|
|
||||||
docker push registry.infra.mintel.me/mintel/mb-grid-solutions:latest
|
|
||||||
|
|
||||||
- name: Setup SSH
|
|
||||||
env:
|
|
||||||
ALPHA_SSH_KEY: ${{ secrets.ALPHA_SSH_KEY }}
|
|
||||||
run: |
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
echo "$ALPHA_SSH_KEY" > ~/.ssh/id_ed25519
|
|
||||||
chmod 600 ~/.ssh/id_ed25519
|
|
||||||
ssh-keyscan -H alpha.mintel.me >> ~/.ssh/known_hosts
|
|
||||||
|
|
||||||
- name: Sync compose file
|
|
||||||
run: |
|
|
||||||
cd "$GITHUB_WORKSPACE"
|
|
||||||
ls -la
|
|
||||||
rsync -av docker-compose.yml \
|
|
||||||
deploy@alpha.mintel.me:/home/deploy/sites/mb-grid-solutions/docker-compose.yml
|
|
||||||
|
|
||||||
- name: Deploy
|
|
||||||
run: |
|
|
||||||
ssh deploy@alpha.mintel.me "
|
|
||||||
cd /home/deploy/sites/mb-grid-solutions &&
|
|
||||||
docker compose pull &&
|
|
||||||
docker compose up -d
|
|
||||||
"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user