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 20, 2025
1 parent 86779ad commit 5e345d2
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,40 @@
name: Deploy to Development

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

jobs:
deploy:
runs-on: self-hosted
runs-on: self-hosted

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


- name: Load Environment Variables
uses: falti/dotenv-action@v1.1.4
with:
export-variables: true
keys-case: bypass

- name: Build Docker Image for Frontend
run: |
# Build the Docker image using the Dockerfile in the frontend folder.
# The dot at the end sets the build context to the repository root.
# Build the image from the Dockerfile in the "frontend" folder
docker build -t myapp:latest -f frontend/Dockerfile .
- name: Stop and Remove Existing Container
- name: Stop Existing Container
run: |
# Stop and remove the existing container if it's running.
# If a container is running, stop and remove it
docker rm -f myapp_container || true
- name: Run New Container
run: |
# 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
# Run the new container in detached mode.
# Map host port 8080 to container port 3000 (adjust as necessary)
docker run -d --name myapp_container -p 8080:3000 myapp:latest
- name: Verify Deployment
run: docker ps

0 comments on commit 5e345d2

Please sign in to comment.