diff --git a/.env_api b/.env_api new file mode 100644 index 0000000..51cc550 --- /dev/null +++ b/.env_api @@ -0,0 +1,12 @@ +DATABASE_TYPE= +DATABASE_HOST= +DATABASE_PORT= +DATABASE_USERNAME= +DATABASE_PASSWORD= +DATABASE_NAME= +DATABASE_SYNCHRONIZE= +AUTH0_ISSUER_URL= +AUTH0_AUDIENCE= +GOOGLE_CLIENT_ID= +GOOGLE_CLIENT_SECRET= +GOOGLE_REDIRECT_URI= diff --git a/.env_db b/.env_db new file mode 100644 index 0000000..8b2a930 --- /dev/null +++ b/.env_db @@ -0,0 +1,3 @@ +POSTGRES_USER= +POSTGRES_PASSWORD= +POSTGRES_DB= diff --git a/.env_web b/.env_web new file mode 100644 index 0000000..caad71e --- /dev/null +++ b/.env_web @@ -0,0 +1,4 @@ +VITE_AUTH0_DOMAIN= +VITE_AUTH0_CLIENTID= +VITE_AUTH0_AUDIENCE= +VITE_BASE_URL= diff --git a/.gitignore b/.gitignore index 3536033..b492ec6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ api/src/modules/GAuth/authInfo /**/dist /**/*.tsbuildinfo .vscode +/**/.env* tmp-* diff --git a/Dockerfile_copy b/Dockerfile_api similarity index 73% rename from Dockerfile_copy rename to Dockerfile_api index 9e74221..7563a25 100644 --- a/Dockerfile_copy +++ b/Dockerfile_api @@ -6,7 +6,6 @@ WORKDIR /app # Copy package.json and package-lock.json COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ -COPY frontend/package.json frontend/ COPY api/package.json api/ COPY shared/package.json shared/ @@ -26,15 +25,11 @@ COPY . . RUN pnpm run format-check # Build the app -RUN pnpm run build +RUN pnpm run build:api # Expose the port EXPOSE 3000 -ENV PORT 3000 -# set hostname to localhost -ENV HOSTNAME "0.0.0.0" - # Start the app -CMD ["pnpm", "dev:api"] +CMD ["pnpm", "preview:api"] diff --git a/Dockerfile b/Dockerfile_web similarity index 78% rename from Dockerfile rename to Dockerfile_web index 4ca1053..befd079 100644 --- a/Dockerfile +++ b/Dockerfile_web @@ -26,15 +26,12 @@ COPY . . RUN pnpm run format-check # Build the app -RUN pnpm run build +RUN pnpm run build:web # Expose the port EXPOSE 5173 - -ENV PORT 5173 -# set hostname to localhost -ENV HOSTNAME "0.0.0.0" +EXPOSE 5174 # Start the app -CMD ["pnpm", "dev:web"] +CMD ["pnpm", "preview:web"] diff --git a/docker-compose-dbonly.yml b/docker-compose-dbonly.yml new file mode 100644 index 0000000..f0377c6 --- /dev/null +++ b/docker-compose-dbonly.yml @@ -0,0 +1,9 @@ +services: + db: + image: postgres:latest + environment: + - POSTGRES_USER=hkrecruitment + - POSTGRES_PASSWORD=password + - POSTGRES_DB=hkrecruitment + ports: + - '5432:5432' diff --git a/docker-compose.yml b/docker-compose.yml index f14af00..380ed3f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,8 @@ services: db: image: postgres:latest - environment: - - POSTGRES_USER=hkrecruitment - - POSTGRES_PASSWORD=password - - POSTGRES_DB=hkrecruitment + env_file: + - .env_db ports: - '5432:5432' @@ -12,9 +10,9 @@ services: web: build: context: . - dockerfile: Dockerfile + dockerfile: Dockerfile_web env_file: - - .env + - .env_web ports: - '5173:5173' depends_on: @@ -23,10 +21,10 @@ services: api: build: context: . - dockerfile: Dockerfile_copy + dockerfile: Dockerfile_api env_file: - - .env + - .env_api ports: - '3000:3000' depends_on: - - db \ No newline at end of file + - db diff --git a/frontend/package.json b/frontend/package.json index 32fd132..8f5a991 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -24,7 +24,7 @@ "scripts": { "dev": "vite", "build": "vite build", - "preview": "vite preview --port 5173", + "preview": "vite preview --host --port 5173", "clean": "rimraf dist", "format": "prettier --write src", "format-check": "prettier --check src" diff --git a/package.json b/package.json index 4fbe562..4d14467 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,8 @@ "dev:api": "pnpm --filter api start:dev", "dev": "pnpm run --stream dev:web & pnpm run --stream dev:api", "dev:tmux": "tmux new-session -d -s hkrecruitment 'pnpm run dev:web' \\; split-window -h -p 50 'pnpm run dev:api' \\; attach", + "build:web": "pnpm --filter frontend build", + "build:api": "pnpm --filter api build", "build": "pnpm --filter frontend build && pnpm --filter api build", "preview:web": "pnpm --filter frontend preview", "preview:api": "pnpm --filter api start:prod", @@ -21,4 +23,4 @@ "keywords": [], "author": "", "license": "ISC" -} \ No newline at end of file +}