docker kompostownik is working 🎉
This commit is contained in:
@@ -3,10 +3,6 @@ services:
|
||||
build:
|
||||
context: ./server
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "${SERVER_PORT}:${SERVER_PORT}"
|
||||
# env_file:
|
||||
# - .server/.env
|
||||
environment:
|
||||
SERVER_PORT: ${SERVER_PORT}
|
||||
JWT_SECRET: ${JWT_SECRET}
|
||||
@@ -14,10 +10,15 @@ services:
|
||||
PG_USER: ${PG_USER}
|
||||
PG_PASSWORD: ${PG_PASSWORD}
|
||||
PG_DATABASE: ${PG_DATABASE}
|
||||
PG_HOST: ${PG_HOST}
|
||||
PG_HOST: db
|
||||
PG_PORT: ${PG_PORT}
|
||||
ports:
|
||||
- "${SERVER_PORT}:${SERVER_PORT}"
|
||||
depends_on:
|
||||
- db
|
||||
db:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- relay-network
|
||||
|
||||
relay-client:
|
||||
build:
|
||||
@@ -25,24 +26,34 @@ services:
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf
|
||||
networks:
|
||||
- relay-network
|
||||
|
||||
db:
|
||||
image: postgres:latest
|
||||
restart: always
|
||||
user: postgres
|
||||
volumes:
|
||||
- db-data:/var/lib/postgresql/data
|
||||
- postgres-data:/var/lib/postgresql/data
|
||||
environment:
|
||||
POSTGRES_USER: ${PG_USER}
|
||||
POSTGRES_DB: ${PG_DATABASE}
|
||||
POSTGRES_PASSWORD: ${PG_PASSWORD}
|
||||
expose:
|
||||
- ${PG_PORT}
|
||||
- "${PG_PORT}"
|
||||
healthcheck:
|
||||
test: [ "CMD", "pg_isready", "-U", "${PG_USER}" ]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
networks:
|
||||
- relay-network
|
||||
|
||||
networks:
|
||||
relay-network:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
postgres-data:
|
||||
18
nginx.conf
Normal file
18
nginx.conf
Normal file
@@ -0,0 +1,18 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://relay-server:4000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
26
server/.env
26
server/.env
@@ -1,14 +1,3 @@
|
||||
SERVER_PORT=3000
|
||||
JWT_SECRET=fdsfsdfds@
|
||||
ORIGIN=http://localhost:5173
|
||||
|
||||
PG_USER=postgres
|
||||
PG_PASSWORD=haslo
|
||||
PG_DATABASE=relay
|
||||
PG_HOST=db
|
||||
PG_PORT=5433
|
||||
|
||||
|
||||
#SERVER_PORT=3000
|
||||
#JWT_SECRET=fdsfsdfds@
|
||||
#ORIGIN=http://localhost:5173
|
||||
@@ -16,5 +5,16 @@ PG_PORT=5433
|
||||
#PG_USER=postgres
|
||||
#PG_PASSWORD=haslo
|
||||
#PG_DATABASE=relay
|
||||
#PG_HOST=192.168.0.47
|
||||
#PG_PORT=5433
|
||||
#PG_HOST=192.168.47
|
||||
#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
|
||||
@@ -1,38 +1,19 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# Comments are provided throughout this file to help you get started.
|
||||
# If you need more help, visit the Dockerfile reference guide at
|
||||
# https://docs.docker.com/go/dockerfile-reference/
|
||||
|
||||
# Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7
|
||||
|
||||
ARG NODE_VERSION=20.17.0
|
||||
|
||||
FROM node:${NODE_VERSION}-alpine
|
||||
|
||||
# Use production node environment by default.
|
||||
ENV NODE_ENV production
|
||||
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Download dependencies as a separate step to take advantage of Docker's caching.
|
||||
# Leverage a cache mount to /root/.npm to speed up subsequent builds.
|
||||
# Leverage a bind mounts to package.json and package-lock.json to avoid having to copy them into
|
||||
# into this layer.
|
||||
RUN --mount=type=bind,source=package.json,target=package.json \
|
||||
--mount=type=bind,source=package-lock.json,target=package-lock.json \
|
||||
--mount=type=cache,target=/root/.npm \
|
||||
npm ci --omit=dev
|
||||
|
||||
# Run the application as a non-root user.
|
||||
USER node
|
||||
|
||||
# Copy the rest of the source files into the image.
|
||||
COPY . .
|
||||
|
||||
# Expose the port that the application listens on.
|
||||
EXPOSE 3000
|
||||
|
||||
# Run the application.
|
||||
CMD node server.js
|
||||
|
||||
Reference in New Issue
Block a user