From e8178bc65072e1286be5615c28df177cd58b1de4 Mon Sep 17 00:00:00 2001 From: Glydric Date: Fri, 26 Jan 2024 10:25:57 +0100 Subject: [PATCH] containerized --- Frontend/.env-example | 1 - Frontend/Dockerfile | 23 ----------------------- Frontend/package.json | 3 ++- README.md | 2 ++ docker-compose.yml | 13 ++++++++----- 5 files changed, 12 insertions(+), 30 deletions(-) delete mode 100644 Frontend/.env-example delete mode 100644 Frontend/Dockerfile diff --git a/Frontend/.env-example b/Frontend/.env-example deleted file mode 100644 index 96e8067..0000000 --- a/Frontend/.env-example +++ /dev/null @@ -1 +0,0 @@ -NEXT_PUBLIC_BACKEND_URL=http://localhost:8080/ \ No newline at end of file diff --git a/Frontend/Dockerfile b/Frontend/Dockerfile deleted file mode 100644 index 88045d0..0000000 --- a/Frontend/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -# Use the official Node.js image as the base image -FROM node:14-alpine - -# Set the working directory inside the container -WORKDIR /app - -# Copy package.json and package-lock.json to the working directory -COPY package*.json ./ - -# Install dependencies -RUN npm install - -# Copy the entire app to the working directory -COPY . . - -# Build the Next.js app -RUN npm run build - -# Expose the port that your Next.js app will run on -EXPOSE 3000 - -# Start the Next.js app -CMD ["npm", "start"] diff --git a/Frontend/package.json b/Frontend/package.json index f4816f4..1ea8e26 100644 --- a/Frontend/package.json +++ b/Frontend/package.json @@ -6,7 +6,8 @@ "dev": "next dev", "build": "next build", "start": "next start", - "lint": "next lint" + "lint": "next lint", + "docker:start": "npm i && npm run build && npm run start" }, "dependencies": { "@ant-design/cssinjs": "^1.17.5", diff --git a/README.md b/README.md index 5ad1e2a..e5b5e89 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,8 @@ OPENVIDU_URL= http://localhost:4443/ OPENVIDU_SECRET=MY_SECRET # Put the IP address of the NVR NVR_IP_ADDRESS= +## Frontend +NEXT_PUBLIC_BACKEND_URL=http://localhost:8080/ ``` Then you can run ```bash diff --git a/docker-compose.yml b/docker-compose.yml index ca345bb..7e22396 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,14 +37,17 @@ services: command: npm run docker:dev frontend: - build: - context: ./Frontend - dockerfile: Dockerfile + container_name: frontend + image: node:21-alpine + depends_on: + - backend restart: on-failure # always ports: - "3000:3000" + working_dir: /home/node + volumes: + - ./Frontend:/home/node env_file: - .secrets.yml - depends_on: - - backend + command: npm run docker:start