fixed docker

This commit is contained in:
Dmitri 2026-04-13 19:52:02 +04:00
parent b98b5106d9
commit 4bb5da9ad6
2 changed files with 14 additions and 35 deletions

View File

@ -11,12 +11,6 @@ WORKDIR /app/backend
COPY backend/package.json backend/yarn.lock ./
RUN yarn install --pure-lockfile
FROM node:20.15.1-alpine AS app-shell-deps
RUN apk add --no-cache git
WORKDIR /app/app-shell
COPY app-shell/package.json app-shell/yarn.lock ./
RUN yarn install --pure-lockfile
# Nginx setup and application build
FROM node:20.15.1-alpine AS build
RUN apk add --no-cache git nginx curl
@ -45,11 +39,9 @@ ENV PATH /root/.yarn/bin:/root/.config/yarn/global/node_modules/.bin:$PATH
WORKDIR /app
COPY --from=frontend-deps /app/frontend /app/frontend
COPY --from=backend-deps /app/backend /app/backend
COPY --from=app-shell-deps /app/app-shell /app/app-shell
COPY frontend /app/frontend
COPY backend /app/backend
COPY app-shell /app/app-shell
COPY docker /app/docker
# Copy all files from root to /app
@ -70,8 +62,6 @@ EXPOSE 8080
ENV NODE_ENV=dev_stage
ENV FRONT_PORT=3001
ENV BACKEND_PORT=3000
ENV APP_SHELL_PORT=4000
CMD ["sh", "-c", "\
yarn --cwd /app/frontend dev & echo $! > /app/pids/frontend.pid && \
@ -82,6 +72,5 @@ CMD ["sh", "-c", "\
while ! nc -z localhost ${BACKEND_PORT}; do \
sleep 2; \
done && \
echo 'Backend is up. Starting app_shell for Git check...' && \
yarn --cwd /app/app-shell start && \
wait $NGINX_PID"]
echo 'Backend and frontend are up.' && \
wait $NGINX_PID"]

View File

@ -1,5 +1,3 @@
version: "3.9"
services:
web:
@ -14,12 +12,8 @@ services:
options:
max-size: "10m"
max-file: "3"
db:
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
image: postgres
volumes:
- ./data/db:/var/lib/postgresql/data
@ -36,23 +30,19 @@ services:
backend:
image: backend
volumes:
- ./wait-for-it.sh:/usr/src/app/wait-for-it.sh
- ./start-backend.sh:/usr/src/app/start-backend.sh
build: ../backend
volumes:
- ./wait-for-it.sh:/usr/src/app/wait-for-it.sh
- ./start-backend.sh:/usr/src/app/start-backend.sh
environment:
- DB_HOST=db
- DB_HOST=db
ports:
- "8080:8080"
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
- "8080:8080"
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
depends_on:
- "db"
- "db"
command: ["bash", "./wait-for-it.sh", "db:5432", "--timeout=0", "--strict", "--", "bash", "./start-backend.sh"]