diff --git a/apps/docker-compose.yml b/apps/docker-compose.yml index ffd4fbc172..bc0fad3a15 100644 --- a/apps/docker-compose.yml +++ b/apps/docker-compose.yml @@ -16,9 +16,6 @@ services: build: context: ./user-service dockerfile: Dockerfile - args: - DB_CLOUD_URI: ${DB_CLOUD_URI} - JWT_SECRET: ${JWT_SECRET} ports: - 3001:3001 networks: diff --git a/apps/frontend/README.md b/apps/frontend/README.md index b84cd38c40..9012775719 100644 --- a/apps/frontend/README.md +++ b/apps/frontend/README.md @@ -42,6 +42,7 @@ You can start editing the page by modifying `app/page.tsx`. The page auto-update ```sh # Navigate to the frontend app directory cd apps/frontend + # Build dockerfile (Ensure that your docker daemon is running beforehand) docker build -t frontend -f Dockerfile . ``` @@ -52,7 +53,7 @@ Run the backend server locally and visit http://localhost:3000/ to see the front ```sh # Run the docker image, the -d tag is to run it detached -docker run -p 3000:3000 -d frontend -e NEXT_PUBLIC_QUESTION_SERVICE_URL="http://localhost:8080/" +docker run -p 3000:3000 --env-file .env -d frontend # To see the running container docker ps diff --git a/apps/frontend/src/app/page.tsx b/apps/frontend/src/app/page.tsx index dfaa71908f..8b623d57ce 100644 --- a/apps/frontend/src/app/page.tsx +++ b/apps/frontend/src/app/page.tsx @@ -268,9 +268,9 @@ export default function Home() { }, [search]); // Table column specification - var columns + var columns: TableProps["columns"] if (isAdmin) { - var columns: TableProps["columns"] = [ + columns = [ { title: "Id", dataIndex: "id", @@ -437,7 +437,7 @@ export default function Home() { }, ]; } else { - var columns: TableProps["columns"] = [ + columns = [ { title: "Id", dataIndex: "id", diff --git a/apps/question-service/Dockerfile b/apps/question-service/Dockerfile index 270c63b8d8..c2a9e0836b 100644 --- a/apps/question-service/Dockerfile +++ b/apps/question-service/Dockerfile @@ -4,6 +4,7 @@ WORKDIR /usr/src/app # pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change COPY go.mod go.sum ./ + RUN go mod tidy && go mod download && go mod verify COPY . . diff --git a/apps/question-service/README.md b/apps/question-service/README.md index f1e1d0d03b..99ed749159 100644 --- a/apps/question-service/README.md +++ b/apps/question-service/README.md @@ -58,7 +58,7 @@ docker build -t question-service . ``` ```bash -docker run -p 8080:8080 -d question-service +docker run -p 8080:8080 --env-file .env -d question-service ``` The server will be available at http://localhost:8080. diff --git a/apps/user-service/Dockerfile b/apps/user-service/Dockerfile index 31f4e477e6..84b064bd40 100644 --- a/apps/user-service/Dockerfile +++ b/apps/user-service/Dockerfile @@ -1,11 +1,5 @@ FROM node:20-alpine AS base -ARG DB_CLOUD_URI -ARG JWT_SECRET -ENV DB_CLOUD_URI=${DB_CLOUD_URI} -ENV JWT_SECRET=${JWT_SECRET} -ENV ENV=PROD - FROM base AS deps WORKDIR /app diff --git a/apps/user-service/README.md b/apps/user-service/README.md index b92fccbe84..b50fb214a3 100644 --- a/apps/user-service/README.md +++ b/apps/user-service/README.md @@ -286,15 +286,16 @@ ```bash # Navigate to the user-service app directory cd apps/user-service -# Build dockerfile after replacing the build arguments (Ensure that your docker daemon is running beforehand) -docker build -t user-service --build-arg JWT_SECRET='replace_with_jwt_secret' --build-arg DB_CLOUD_URI='replace_with_db_uri_here' -f Dockerfile . + +# Build dockerfile (Ensure that your docker daemon is running beforehand) +docker build -t user-service -f Dockerfile . ``` ### Running Docker ```bash # Run the docker image, the -d tag is to run it detached -docker run -p 3001:3001 -d user-service +docker run -p 3001:3001 --env-file .env -d user-service # To check the container information docker ps