Skip to content
This repository was archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
chore: Add docker and improve Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
devkcud committed Apr 6, 2024
1 parent c21b7f9 commit 5da59fe
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ GOBUILD=$(GO) build
GOCLEAN=$(GO) clean
GOTEST=$(GO) test

include .env
export

all: build run

build: cmd/api/main.go
Expand All @@ -14,9 +17,21 @@ build: cmd/api/main.go
run:
PORT=8080 "$(BUILD_FOLDER)/$(BUILD_FILE)"

clean:
clean: down
@# Use "$(GOCLEAN)" so it removes any self-compiled bins (not using `make build`)
$(GOCLEAN)
-rm -r $(BUILD_FOLDER)

tidy:
go mod tidy -e

up:
docker compose up -d

down:
docker compose down

psql:
docker exec -it arkhon-db psql -U $(POSTGRES_USER) -d $(POSTGRES_DB)

.PHONY: build run all
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
services:
postgres:
image: postgres:latest
container_name: arkhon-db
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
env_file:
- .env
ports:
- '5432:5432'
volumes:
- ./pgdata:/var/lib/postgresql/data

0 comments on commit 5da59fe

Please sign in to comment.