Skip to content

Commit 3ce9636

Browse files
committed
CD tornado: seup CD pipeline for tornado server deplymed to azure.
1 parent 2f2d329 commit 3ce9636

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Deploy Tornado WebSocket Server
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
workflow_dispatch:
8+
9+
jobs:
10+
build-and-deploy:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
# Step 1: Checkout the repository
15+
- name: Checkout repository
16+
uses: actions/checkout@v3
17+
18+
# Step 2: Set up Docker Buildx for building images
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v2
21+
22+
# Step 3: Log in to Docker Hub using credentials stored in GitHub secrets
23+
- name: Log in to Docker Hub
24+
uses: docker/login-action@v2
25+
with:
26+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
27+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
28+
29+
# Step 4: Build and tag the Docker image
30+
- name: Build and tag Docker image
31+
run: |
32+
docker build -f ./tools/dockerfiles/Dockerfile.tornado -t jitenky/dragonfly-tornado:latest .
33+
34+
# Step 5: Push the Docker image to Docker Hub
35+
- name: Push Docker image to Docker Hub
36+
run: |
37+
docker push jitenky/dragonfly-tornado:latest
38+
39+
- name: Log in to Azure
40+
uses: azure/login@v1
41+
with:
42+
creds: ${{ secrets.AZURE_CREDENTIALS }}
43+
44+
- name: Restart Azure App Service
45+
run: |
46+
az webapp restart --name dragonfly-tornado-2 --resource-group dragonfly
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Use official Python image as a base
2+
FROM python:3.10
3+
4+
# Set environment variables
5+
ENV PYTHONUNBUFFERED=1
6+
7+
# Set the working directory inside the container
8+
WORKDIR /app
9+
10+
# Copy requirements and install dependencies
11+
COPY requirements/production.txt requirements.txt
12+
RUN pip install --no-cache-dir -r requirements.txt
13+
14+
# Copy the rest of the application code
15+
COPY . .
16+
17+
# Expose port 8888 for Tornado WebSocket server
18+
EXPOSE 8888
19+
20+
# Run the Tornado server
21+
CMD ["python", "zserver/tornado/server.py"]

0 commit comments

Comments
 (0)