From 254c755a3a953334165f6e4efcf84b8df8774911 Mon Sep 17 00:00:00 2001 From: Arth <65160206@go.buu.ac.th> Date: Thu, 27 Mar 2025 13:21:04 +0700 Subject: [PATCH] deploy --- .env | 1 + .env.production | 1 + Dockerfile | 19 +++++++++++++++++++ docker-compose.yml | 7 +++++++ src/services/http.ts | 2 +- 5 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 .env create mode 100644 .env.production create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.env b/.env new file mode 100644 index 0000000..ddde050 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +VITE_API_BASE_URL=http://localhost:4000 diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..4f03d5e --- /dev/null +++ b/.env.production @@ -0,0 +1 @@ +VITE_API_BASE_URL=http://dekdee3.informatics.buu.ac.th:8012 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cccbb4a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +# Build stage +FROM node:18 AS builder +WORKDIR /app + +COPY package*.json ./ +RUN npm install + +COPY . . +RUN npm run build + +# Production stage +FROM nginx:stable-alpine +COPY --from=builder /app/dist /usr/share/nginx/html + +# copy nginx config if needed (optional) +# COPY nginx.conf /etc/nginx/nginx.conf + +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..639a1b7 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +version: "3" +services: + lookoad-frontend: + build: . + ports: + - "8011:80" # นายจองไว้เรียบร้อย + restart: always diff --git a/src/services/http.ts b/src/services/http.ts index 6997076..c682654 100644 --- a/src/services/http.ts +++ b/src/services/http.ts @@ -2,7 +2,7 @@ import router from '@/router' import axios from 'axios' const instance = axios.create({ - baseURL: 'http://localhost:4000' + baseURL: import.meta.env.VITE_API_BASE_URL }) function delay(sec: number) { -- GitLab