diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a45be33 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +.git +node_modules +build +*.lock diff --git a/Dockerfile b/Dockerfile index f1f272f..7c7e998 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,12 @@ FROM node:18.14.0-alpine RUN mkdir app WORKDIR /app +ARG REACT_APP_NODE_ENV +ARG REACT_APP_BASE_URL + +ENV REACT_APP_NODE_ENV="production" +ENV REACT_APP_BASE_URL="http://localhost:8002/api/v1" + COPY . . RUN yarn RUN yarn build @@ -11,5 +17,3 @@ CMD serve -s build EXPOSE 3000/tcp -ENV REACT_APP_NODE_ENV="production" -ENV REACT_APP_BASE_URL="http://localhost:8002/api/v1" diff --git a/docker-compose.yaml b/docker-compose.yaml index 31c79c0..610162a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -8,7 +8,14 @@ services: ports: - '5432:5432' environment: + - 'POSTGRES_USER=postgres' + - 'POSTGRES_DB=todo-list' - 'POSTGRES_PASSWORD=root' + volumes: + - postgresdata:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"] + app-backend: container_name: app-backend build: @@ -17,7 +24,8 @@ services: image: 'backend-todolist:1.0.0' restart: always depends_on: - - postgresql-backend + postgresql-backend: + condition: service_healthy ports: - '8002:8002' environment: