Skip to content

Commit e5eeca1

Browse files
git commit -m 'updated documentation'
1 parent 634c6d6 commit e5eeca1

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

.github/workflows/autodeploy.yml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ on:
44
push:
55
branches: ms/Scrun-130-Project-Deployment-dockerfiles
66
jobs:
7-
test:
7+
CI-PIPELINE:
88
runs-on: ubuntu-latest
9-
9+
10+
# Installs needed dependencies
1011
steps:
1112
- name: Checkout Code
1213
uses: actions/checkout@v3
@@ -15,16 +16,18 @@ jobs:
1516
uses: actions/setup-node@v3
1617
with:
1718
node-version: 18
18-
19+
20+
# Tests code too ensure it passes all tests
1921
- name: Run frontend tests
2022
run: cd course-matrix/frontend && npm install && npm run test
2123
- name: Run backend tests
2224
run: cd course-matrix/backend && npm install && npm run test
2325

24-
# Step 2: Set up Docker Buildx (optional for multi-platform support)
26+
# Set up Docker Buildx
2527
- name: Set up Docker Buildx
2628
uses: docker/setup-buildx-action@v2
2729

30+
# Sets our our application's environment
2831
- name: setup application env
2932
run: |
3033
cd course-matrix
@@ -35,7 +38,7 @@ jobs:
3538
echo "VITE_PUBLIC_ASSISTANT_BASE_URL=\"${{ secrets.VITE_PUBLIC_ASSISTANT_BASE_URL }}\"" >> .env && \
3639
echo "VITE_ASSISTANT_UI_KEY=\"${{ secrets.VITE_ASSISTANT_UI_KEY }}\"" >> .env
3740

38-
# Move to backend
41+
# Update backend .env
3942
cd ../backend
4043
echo "NODE_ENV=\"development\"" > .env && \
4144
echo "PORT=8081" >> .env && \
@@ -50,45 +53,50 @@ jobs:
5053
echo "SENDER_NAME=\"Course Matrix Notifications\"" >> .env
5154

5255
cd ../
53-
56+
57+
# Logging in to dockerhub
5458
- name: Log in to Docker Hub
5559
uses: docker/login-action@v3
5660
with:
5761
username: ${{ secrets.DOCKERHUB_USERNAME }}
5862
password: ${{ secrets.DOCKERHUB_TOKEN }}
5963

60-
# Build and push frontend Docker image
64+
# Build all required doccker images
6165
- name: Build Docker Image
6266
run: |
6367
cd course-matrix
6468
docker compose build
6569
70+
# Check if images exist before tagging
6671
- name: List Docker Images (Debugging)
67-
run: docker images # Check if images exist before tagging
72+
run: docker images
6873

74+
# Tags created images with version using github commit tags
6975
- name: Tag Images With Version
7076
run: |
7177
docker tag course-matrix/frontend:latest ${{ secrets.DOCKERHUB_USERNAME }}/course-matrix-frontend:${{ github.sha }}
7278
docker tag course-matrix/backend:latest ${{ secrets.DOCKERHUB_USERNAME }}/course-matrix-backend:${{ github.sha }}
7379
74-
# Step 5: Push Docker images to Docker Hub
80+
# Push Docker images version to Docker Hub
7581
- name: Push Docker images version to Docker Hub
7682
run: |
7783
docker push ${{ secrets.DOCKERHUB_USERNAME }}/course-matrix-frontend:${{ github.sha }}
7884
docker push ${{ secrets.DOCKERHUB_USERNAME }}/course-matrix-backend:${{ github.sha }}
79-
85+
86+
# Tags created images for the master branch
8087
- name: Tag Images for Master Branch
8188
run: |
8289
docker tag course-matrix/frontend:latest ${{ secrets.DOCKERHUB_USERNAME }}/course-matrix-frontend:master
8390
docker tag course-matrix/backend:latest ${{ secrets.DOCKERHUB_USERNAME }}/course-matrix-backend:master
84-
91+
92+
# Push Docker images to Docker Hub master branch
8593
- name: Push images to Master Branch
8694
run: |
8795
docker push ${{ secrets.DOCKERHUB_USERNAME }}/course-matrix-frontend:master
8896
docker push ${{ secrets.DOCKERHUB_USERNAME }}/course-matrix-backend:master
8997
90-
deploy:
91-
needs: test
98+
CD-PIPELINE:
99+
needs: CI-PIPELINE
92100
runs-on: ubuntu-latest
93101

94102
steps:

course-matrix/frontend/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ RUN npm install
1313
# Copy the rest of the application files
1414
COPY . .
1515

16-
# Expose the backend port
17-
EXPOSE 8081
16+
# Expose the frontend port
17+
EXPOSE 5173
1818

1919
# Start the application
2020
CMD ["npm", "run", "dev"]

0 commit comments

Comments
 (0)