diff --git a/client/.dockerignore b/client/.dockerignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/client/.dockerignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/client/.env b/client/.env index 2b6f29b..c3da097 100644 --- a/client/.env +++ b/client/.env @@ -1 +1,2 @@ -VITE_API_URL=http://localhost:5173 \ No newline at end of file +VITE_API_URL=http://localhost:5173 +VITE_BASE_URL=http://localhost:5173 diff --git a/client/Dockerfile b/client/Dockerfile new file mode 100644 index 0000000..6a60006 --- /dev/null +++ b/client/Dockerfile @@ -0,0 +1,25 @@ +FROM node:18 AS builder + +WORKDIR /app/client + +COPY . . + +# Install dependencies +RUN npm install + +# Build the project +RUN npm run build + +FROM nginx:alpine + +# Remove the default Nginx configuration file +RUN rm /etc/nginx/conf.d/default.conf + +# Copy the built files from the builder stage to the Nginx image +COPY --from=builder /app/client/dist /usr/share/nginx/html + +# Expose port 80 +EXPOSE 80 + +# Start Nginx in the foreground +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/client/nginx.conf b/client/nginx.conf new file mode 100644 index 0000000..2e75692 --- /dev/null +++ b/client/nginx.conf @@ -0,0 +1,17 @@ +server { + listen 80; + listen [::]:80; + + server_name ${VITE_BASE_URL}; + + location /api { + proxy_pass ${VITE_API_URL}; + include proxy_params; + } + + root /app/client + + location / { + try_files $uri /index.html; + } +} \ No newline at end of file diff --git a/client/package-lock.json b/client/package-lock.json index 962032f..cddb895 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -33,7 +33,7 @@ "postcss": "^8.4.47", "prettier": "3.3.3", "tailwindcss": "^3.4.13", - "typescript": "^5.5.3", + "typescript": "^5.6.3", "typescript-eslint": "^8.0.1", "vite": "^5.4.1" } @@ -4252,9 +4252,9 @@ } }, "node_modules/typescript": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", - "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", + "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", "dev": true, "license": "Apache-2.0", "bin": { diff --git a/client/package.json b/client/package.json index f2f37bb..cd790c9 100644 --- a/client/package.json +++ b/client/package.json @@ -35,7 +35,7 @@ "postcss": "^8.4.47", "prettier": "3.3.3", "tailwindcss": "^3.4.13", - "typescript": "^5.5.3", + "typescript": "^5.6.3", "typescript-eslint": "^8.0.1", "vite": "^5.4.1" } diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4d1deea --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,43 @@ +services: + relay-server: + build: + context: ./server + dockerfile: Dockerfile + ports: + - "${SERVER_PORT}:${SERVER_PORT}" +# env_file: +# - .server/.env + environment: + SERVER_PORT: ${SERVER_PORT} + JWT_SECRET: ${JWT_SECRET} + ORIGIN: ${ORIGIN} + PG_USER: ${PG_USER} + PG_PASSWORD: ${PG_PASSWORD} + PG_DATABASE: ${PG_DATABASE} + PG_HOST: ${PG_HOST} + PG_PORT: ${PG_PORT} + depends_on: + - db + + relay-client: + build: + context: ./client + dockerfile: Dockerfile + ports: + - "80:80" + + db: + image: postgres:latest +# env_file: +# - .server/.env + environment: + POSTGRES_USER: ${PG_USER} + POSTGRES_PASSWORD: ${PG_PASSWORD} + POSTGRES_DB: ${PG_DATABASE} + volumes: + - postgres-data:/var/lib/postgresql/data + ports: + - "${PG_PORT}:${PG_PORT}" + +volumes: + postgres-data: \ No newline at end of file diff --git a/server/.dockerignore b/server/.dockerignore new file mode 100644 index 0000000..dc157ff --- /dev/null +++ b/server/.dockerignore @@ -0,0 +1,34 @@ +# Include any files or directories that you don't want to be copied to your +# container here (e.g., local build artifacts, temporary files, etc.). +# +# For more help, visit the .dockerignore file reference guide at +# https://docs.docker.com/go/build-context-dockerignore/ + +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/.next +**/.cache +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/charts +**/docker-compose* +**/compose.y*ml +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +**/build +**/dist +LICENSE +README.md diff --git a/server/.env b/server/.env index e07d972..80ec2a7 100644 --- a/server/.env +++ b/server/.env @@ -5,5 +5,16 @@ ORIGIN=http://localhost:5173 PG_USER=postgres PG_PASSWORD=haslo PG_DATABASE=relay -PG_HOST=192.168.0.47 -PG_PORT=5433 \ No newline at end of file +PG_HOST=db +PG_PORT=5433 + + +#SERVER_PORT=3000 +#JWT_SECRET=fdsfsdfds@ +#ORIGIN=http://localhost:5173 +# +#PG_USER=postgres +#PG_PASSWORD=haslo +#PG_DATABASE=relay +#PG_HOST=192.168.0.47 +#PG_PORT=5433 \ No newline at end of file