Skip to content

Commit

Permalink
add workflow to push docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
saketh-05 committed Dec 26, 2024
1 parent 48c5df8 commit 217a04e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/dockerimages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Push to dockerhub

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

- name: Build and push frontend Docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/frontend:latest -f Frontend/Dockerfile ./Frontend
docker push ${{ secrets.DOCKER_USERNAME }}/frontend:latest
- name: Build and push backend Docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/backend:latest -f Backend/Dockerfile ./Backend
docker push ${{ secrets.DOCKER_USERNAME }}/backend:latest
3 changes: 2 additions & 1 deletion Backend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const cors = require("cors");
//const fs = require("fs");
const http = require("http");
const app = express();
const port = process.env.PORT || 8080;
app.use(express.json());

// const key = fs.readFileSync('localhost-key.pem', 'utf8');
Expand All @@ -20,7 +21,7 @@ app.use(cors({
credentials: true, // Include credentials if needed
}));

http.createServer(app).listen(8080, () => {
http.createServer(app).listen(port, () => {
console.log(`Server is running on port 3000`);
});

Expand Down
3 changes: 2 additions & 1 deletion Frontend/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
VITE_SPOONACULAR_API = "3a55f59cdb6d4131a3ebb3dc18463a7b"
VITE_BACKEND_URL = "http://api.foodtube.me"
VITE_BACKEND_URL = "http://api.foodtube.me"
PORT = 8080

0 comments on commit 217a04e

Please sign in to comment.