Skip to content

Commit

Permalink
feat: docker
Browse files Browse the repository at this point in the history
  • Loading branch information
SharkEzz committed Jan 1, 2022
1 parent 86ff5e9 commit e1825a9
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM golang:1.17.5 as sattrack_runner

WORKDIR /app
COPY . .

RUN go get -d -v ./...
RUN make sattrack

WORKDIR /app/build
RUN mv /app/sattrack /app/build
RUN mkdir /app/build/database

ENTRYPOINT [ "/app/build/sattrack", "-update" ]

EXPOSE 8000
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ endif

DATE := $(shell date -u +%Y%m%d.%H%M%S)

LDFLAGS = -ldflags "-X=main.version=$(VERSION)-$(DATE)"
LDFLAGS = -trimpath -ldflags "-X=main.version=$(VERSION)-$(DATE)"

.PHONY: sattrack clean

Expand Down
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '3'

services:
sattrack:
build: .
container_name: sattrack
restart: unless-stopped
networks:
- proxy
volumes:
- ./data:/app/build/database:delegated
labels:
- "traefik.enable=true"
- "traefik.http.routers.sattrack.entrypoints=http"
- "traefik.http.routers.sattrack.rule=Host(`sattrack.space`)"
- "traefik.docker.network=proxy"

networks:
proxy:
external: true
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func main() {
log.Println("Starting", appName, version)
flag.Parse()

db := database.Init("./local.db")
db := database.Init("./database/local.db")

if *shouldUpdate {
services.UpdateDatabase(*tleListURL, db)
Expand Down

0 comments on commit e1825a9

Please sign in to comment.