Skip to content

Commit

Permalink
Update deploy-dev.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
haahauge authored and GitHub Enterprise committed Mar 19, 2025
1 parent 247fe12 commit 5c99915
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
name: Deploy to Development

# Trigger on every push to the main branch
on:
push:
branches:
- main

jobs:
deploy:
runs-on: self-hosted
runs-on: self-hosted # Make sure your NTNU server runner is online

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Checkout Repository
uses: actions/checkout@v3

- name: Build Docker image
- name: Build Docker Image for Frontend
run: |
# Build the Docker image and tag it with "latest"
docker build -t myapp:latest .
- name: Stop and remove existing container
# Build the Docker image using the Dockerfile in the frontend folder.
# The dot at the end sets the build context to the repository root.
docker build -t myapp:latest -f frontend/Dockerfile .
- name: Stop and Remove Existing Container
run: |
# If there's an existing container, stop and remove it.
# Stop and remove the existing container if it's running.
docker rm -f myapp_container || true
- name: Run Docker container
- name: Run New Container
run: |
# Run the new container in detached mode, mapping port 80
docker run -d --name myapp_container -p 80:80 myapp:latest
# Run the updated container in detached mode.
# Adjust port mapping if your container listens on a different port.
docker run -d --name myapp_container -p 80:3000 myapp:latest
- name: Verify Deployment
run: docker ps

0 comments on commit 5c99915

Please sign in to comment.