-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ls1intum/cicd
added ci cd pipeline
- Loading branch information
Showing
10 changed files
with
149 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: Deploy Angelos-UI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Check if Docker network exists and create it if not | ||
run: | | ||
if ! docker network inspect angelos-network >/dev/null 2>&1; then | ||
echo "Network 'angelos-network' does not exist, creating it..." | ||
docker network create angelos-network | ||
else | ||
echo "Network 'angelos-network' already exists." | ||
fi | ||
- name: Build and Push to GitHub Container Registry | ||
uses: docker/build-push-action@v6 | ||
with: | ||
platforms: amd64, arm64 | ||
file: ./Dockerfile | ||
context: . | ||
tags: ghcr.io/ls1intum/eunomnia:latest | ||
push: true | ||
|
||
deploy: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Copy Docker Compose File From Repo to VM Host | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ vars.VM_HOST }} | ||
username: ${{ vars.VM_USERNAME }} | ||
key: ${{ secrets.VM_SSH_PRIVATE_KEY }} | ||
proxy_host: ${{ vars.DEPLOYMENT_GATEWAY_HOST }} | ||
proxy_username: ${{ vars.DEPLOYMENT_GATEWAY_USER }} | ||
proxy_key: ${{ secrets.DEPLOYMENT_GATEWAY_SSH_KEY }} | ||
proxy_port: ${{ vars.DEPLOYMENT_GATEWAY_PORT }} | ||
source: "./docker-compose.yml" | ||
target: /home/${{ vars.VM_USERNAME }} | ||
|
||
|
||
- name: SSH to VM and Execute Docker-Compose Up | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ vars.VM_HOST }} | ||
username: ${{ vars.VM_USERNAME }} | ||
key: ${{ secrets.VM_SSH_PRIVATE_KEY }} | ||
proxy_host: ${{ vars.DEPLOYMENT_GATEWAY_HOST }} | ||
proxy_username: ${{ vars.DEPLOYMENT_GATEWAY_USER }} | ||
proxy_key: ${{ secrets.DEPLOYMENT_GATEWAY_SSH_KEY }} | ||
proxy_port: ${{ vars.DEPLOYMENT_GATEWAY_PORT }} | ||
script: | | ||
docker compose -f /home/${{ vars.VM_USERNAME }}/docker-compose.yml --env-file=.env.prod up --pull=always -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM node:20-alpine AS build | ||
WORKDIR /app | ||
|
||
COPY package.json package-lock.json ./ | ||
RUN npm install | ||
|
||
COPY . ./ | ||
RUN npm install | ||
RUN npm run build -- --configuration=production | ||
|
||
FROM nginx:stable-alpine | ||
COPY nginx.conf /etc/nginx/conf.d/default.conf | ||
COPY --from=build /app/dist/angelos-ui/browser /usr/share/nginx/html | ||
|
||
EXPOSE 80 | ||
|
||
CMD ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
services: | ||
angelos-ui: | ||
image: "ghcr.io/ls1intum/angelos-ui:latest" | ||
ports: | ||
- "80:80" | ||
container_name: angelos-ui | ||
expose: | ||
- "80" | ||
networks: | ||
- angelos-network | ||
|
||
networks: | ||
angelos-network: | ||
external: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
server { | ||
|
||
listen 80; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
error_page 500 502 503 504 /50x.html; | ||
|
||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const environment = { | ||
production: false, | ||
angelosUrl: 'http://localhost:8000/api/v1/question/chat' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const environment = { | ||
production: true, | ||
angelosUrl: 'http://angelos-app:8000/api/v1/question/chat' | ||
}; |