Updated makefile/dockerfile/compose files

This commit is contained in:
2023-12-19 16:16:30 -05:00
parent 0b4145ac30
commit 6f002856c1
10 changed files with 78 additions and 69 deletions

View File

@@ -1,10 +1,10 @@
RUST_LOG=warn,service=debug
DATABASE_CONTAINER=weather-service
DATABASE_CONTAINER=aviation-service
DATABASE_USER=weather
DATABASE_USER=aviation
DATABASE_PASSWORD=
DATABASE_NAME=weather
DATABASE_NAME=aviation
DATABASE_HOST=localhost
DATABASE_PORT=5432
@@ -12,7 +12,7 @@ REDIS_HOST=localhost
REDIS_PORT=6379
MINIO_ROOT_USER=weather
MINIO_ROOT_PASSWORD=7LtSkxU15ix40nu
MINIO_ROOT_PASSWORD=
MINIO_HOST=localhost
MINIO_PORT=9000
MINIO_PORT_INTERNAL=9001

View File

@@ -1,6 +1,8 @@
#!make
SHELL := /bin/bash
GIT_HASH ?= $(shell git log --format="%h" -n 1)
include .env
.PHONY: help build start stop lint
@@ -11,7 +13,7 @@ help: ## This info
@echo
build: ## Build the Docker image
docker compose build
export TAG=${GIT_HASH} && docker compose build
utils: ## Start the utils
docker compose up -d db
@@ -24,14 +26,14 @@ up: ## Start the Docker containers
down: ## Stop the Docker containers
docker compose down
connect: ## Connect to the Weather DB
connect: ## Connect to the PSQL DB
docker exec -it ${DATABASE_CONTAINER} psql -U postgres
clean: ## Cleanup Docker containers
docker compose down && \
docker image rm weather-service || \
docker network rm weather-frontend || \
docker network rm weather-backend
docker image rm aviation-service || \
docker network rm aviation-frontend || \
docker network rm aviation-backend
clean-db: ## Remove database
docker exec -i ${DATABASE_CONTAINER} sh -c 'PGPASSWORD=${DATABASE_PASSWORD} psql -U ${DATABASE_USER} -d postgres -c "DROP DATABASE IF EXISTS \"${DATABASE_NAME}\";"'

View File

@@ -1,10 +1,10 @@
version: '3'
name: weather
name: aviation
services:
db:
image: postgis/postgis:latest
container_name: weather-db
container_name: aviation-db
env_file:
- .env
environment:
@@ -21,7 +21,7 @@ services:
restart: unless-stopped
redis:
image: redis:latest
container_name: weather-redis
container_name: aviation-redis
volumes:
- redis:/data
ports:
@@ -31,7 +31,7 @@ services:
restart: unless-stopped
minio:
image: minio/minio
container_name: weather-minio
container_name: aviation-minio
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
@@ -46,7 +46,7 @@ services:
restart: unless-stopped
service:
container_name: weather-service
container_name: aviation-service
env_file:
- .env
environment:
@@ -63,9 +63,12 @@ services:
- "${SERVICE_PORT:-5000}:5000"
build:
context: .
tags:
- aviation-service:${TAG:-latest}
depends_on:
- db
- redis
- minio
networks:
- frontend
- backend