diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..e69de29 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e84e9f0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +# 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 . . + + +# Install a simple HTTP server for serving static content +RUN npm install -g http-server + +# Expose the port the app runs on +EXPOSE 3000 +# Start the application +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; + } + +}