From 8cdc2f65ef658f542404dd5eab4aa6d5025b4464 Mon Sep 17 00:00:00 2001 From: L Monster Date: Fri, 20 Jun 2025 09:38:10 +0800 Subject: [PATCH 1/4] dockerfile --- Dockerfile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4ccff47 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +# Use Node.js 22 Alpine as the base image +FROM node:22-alpine + +# Set the working directory in the container +WORKDIR /app + +# Copy package.json and package-lock.json +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the application code +COPY . . + +# Build the Vue.js application +RUN npm run build + +# Install a simple HTTP server for serving static content +RUN npm install -g http-server + +# Expose the port the app runs on +EXPOSE 8080 + +# Start the application +CMD ["npm", "run", "dev:all"] \ No newline at end of file From c3313bfc17a8f47f11d4b9d681245dffd0b7d586 Mon Sep 17 00:00:00 2001 From: L Monster Date: Fri, 20 Jun 2025 09:39:53 +0800 Subject: [PATCH 2/4] add .env.example --- .env.example | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..e69de29 From 97c0236ad48c0e1d429f90f35dc65f9d94f7d638 Mon Sep 17 00:00:00 2001 From: L Monster Date: Fri, 20 Jun 2025 10:05:20 +0800 Subject: [PATCH 3/4] docker --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4ccff47..592a715 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,6 @@ RUN npm install -g http-server # Expose the port the app runs on EXPOSE 8080 - +EXPOSE 3000 # Start the application CMD ["npm", "run", "dev:all"] \ No newline at end of file From 27d44a5ec3ebe5a237d986d805cb67c5d94fb0af Mon Sep 17 00:00:00 2001 From: longke Date: Fri, 20 Jun 2025 11:28:53 +0800 Subject: [PATCH 4/4] deploy file --- Dockerfile | 5 +---- docker-compose.yml | 23 +++++++++++++++++++++++ nginx.conf | 11 +++++++++++ 3 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 docker-compose.yml create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile index 592a715..e84e9f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,14 +13,11 @@ RUN npm install # Copy the rest of the application code COPY . . -# Build the Vue.js application -RUN npm run build # Install a simple HTTP server for serving static content RUN npm install -g http-server # Expose the port the app runs on -EXPOSE 8080 EXPOSE 3000 # Start the application -CMD ["npm", "run", "dev:all"] \ No newline at end of file +CMD ["node", "backend/server.js"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..12bf4ac --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,23 @@ +version: '3' +services: + app: + build: . + ports: + - '18081:3000' + environment: + - DB_HOST= + - DB_USER=nilai_clock + - DB_PASSWORD= + - DB_NAME=nilai_clock + - DB_PORT=3306 + - VITE_API_BASE_URL=//seiyaku.whealthfields.com.my/api + volumes: + - ./rebuild/dist:/app/dist + + nginx: + image: nginx:latest + ports: + - "18080:80" + volumes: + - ./build/dist:/usr/share/nginx/html + - ./nginx.conf:/etc/nginx/conf.d/default.conf diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..d28f7e8 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,11 @@ +server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html; + try_files $uri $uri/ /index.html; + } + +}