Skip to content

Commit

Permalink
Local Docker setup
Browse files Browse the repository at this point in the history
  • Loading branch information
gouline committed Sep 9, 2024
1 parent b9d8ef4 commit b4a765a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
include .env # Requires SLACK_CLIENT_ID and SLACK_CLIENT_SECRET

IMAGE := blaster:latest

export HOST ?= localhost
export PORT ?= 4000
export CERT_FILE ?= certs/localhost.crt
Expand All @@ -12,3 +14,20 @@ run:
.PHONY: test
test:
go test -v ./...

.PHONY: docker-build
docker-build:
docker build -t $(IMAGE) .

.PHONY: docker-run
docker-run: docker-build
docker run --rm \
-e DEBUG=1 \
-e PORT=$(PORT) \
-e CERT_FILE="$(CERT_FILE)" \
-e KEY_FILE="$(KEY_FILE)" \
-e SLACK_CLIENT_ID="$(SLACK_CLIENT_ID)" \
-e SLACK_CLIENT_SECRET="$(SLACK_CLIENT_SECRET)" \
-p $(PORT):$(PORT) \
-v "$(PWD)/certs:/app/certs" \
$(IMAGE)
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"log"
"os"

"github.com/gouline/blaster/internal/pkg/server"
Expand All @@ -23,5 +24,5 @@ func main() {
panic(fmt.Sprintf("Failed to create server: %s", err))
}

s.Run()
log.Fatal(s.Run())
}

0 comments on commit b4a765a

Please sign in to comment.