Skip to content
Merged

Main #19

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ��� Deploy Frontend to Server
name: 🚀 Deploy Full Stack to Server

on:
push:
Expand All @@ -10,11 +10,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: ��� Set up SSH
- name: 🔑 Set up SSH
uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.DEPLOY_KEY }}

- name: ��� Deploy via SSH
- name: 🚀 Deploy via SSH
run: |
ssh -o StrictHostKeyChecking=no root@187.33.149.121 '/root/update-frontend.sh'
ssh -o StrictHostKeyChecking=no root@187.33.149.121 '/root/start.sh'
20 changes: 14 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
FROM node:20
# Etapa 1: build del frontend
FROM node:20 AS build

WORKDIR /app

COPY package*.json ./
RUN npm install

COPY . .
RUN npm run build

# Etapa 2: nginx per servir estàtics
FROM nginx:alpine

# Copiem el build al directori de nginx
COPY --from=build /app/build /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf

ENV HOST=0.0.0.0
# Opcional: custom nginx.conf si cal
# COPY nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 3000
EXPOSE 80

CMD ["npm", "run", "start"]
CMD ["nginx", "-g", "daemon off;"]
11 changes: 11 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
server {
listen 80;
server_name _;

root /usr/share/nginx/html;
index index.html;

location / {
try_files $uri /index.html;
}
}
2 changes: 1 addition & 1 deletion src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const isLocalhost = window.location.hostname === 'localhost' ||

const baseURL = isLocalhost
? 'http://127.0.0.1:8000/'
: 'http://187.33.149.121/';
: 'http://187.33.149.121:8000/';

const api = axios.create({
baseURL,
Expand Down