5 Commits
Author SHA1 Message Date
FernandoJVideira 3585fa0658 Merge branch 'master' into dev 2026-03-18 14:14:21 +00:00
FernandoJVideira d1be60e201 Merge pull request 'dev' (#9) from dev into master
Reviewed-on: https://gitea.fernandovideira.com/FernandoJVideira/velox-bot/pulls/9
2026-03-18 14:11:39 +00:00
FernandoJVideira 26e1d9b094 feat: update Docker configuration and environment handling
- Added PostgreSQL service to docker-compose.yml with health checks and persistent storage.
- Updated bot service to use environment variable substitution for database connection string.
- Upgraded Go version in Dockerfile to 1.26.1-alpine.
- Modified config loading to ignore missing .env file for better compatibility with Docker.
2026-03-18 14:08:21 +00:00
FernandoJVideira 461f8435c0 feat: add Docker support and bot configuration
- Introduced Dockerfile for building the bot application using Go.
- Added .dockerignore to exclude unnecessary files from the Docker context.
- Updated docker-compose.yml to define the bot service and its dependencies, including environment variables for database and Lavalink configuration.
- Modified internal configuration to streamline environment variable handling.
2026-03-18 13:39:31 +00:00
FernandoJVideira 1b47bd13a3 Merge pull request 'ft/mod' (#8) from ft/mod into dev
Reviewed-on: https://gitea.fernandovideira.com/FernandoJVideira/velox-bot/pulls/8
2026-03-18 13:22:26 +00:00
4 changed files with 55 additions and 14 deletions
+7
View File
@@ -0,0 +1,7 @@
.git
.gitignore
.env
*.md
Dockerfile
docker-compose*.yml
.dockerignore
+21
View File
@@ -0,0 +1,21 @@
# Build stage
FROM golang:1.26.1-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o /velox-bot .
# Run stage
FROM alpine:3.19
RUN apk add --no-cache ca-certificates tzdata
WORKDIR /app
COPY --from=builder /velox-bot .
ENTRYPOINT ["./velox-bot"]
+19 -2
View File
@@ -19,5 +19,22 @@ services:
timeout: 5s
retries: 5
volumes:
velox_pgdata:
bot:
build: .
container_name: velox-bot
restart: unless-stopped
env_file: .env
environment:
DB_HOST: ${DB_HOST:-postgres://velox:velox_pwd@db:5432/velox?sslmode=disable}
LAVALINK_HOST: ${LAVALINK_HOST:-ws://lavalink:2333}
LAVALINK_PASSWORD: ${LAVALINK_PASSWORD:-youshallnotpass}
depends_on:
db:
condition: service_healthy
networks:
- default
- lavalink
networks:
lavalink:
external: true
+8 -12
View File
@@ -8,19 +8,18 @@ import (
)
type Config struct {
BotToken string
AppID string
GuildID string
DBHost string
LavalinkHost string
LavalinkPass string
BotToken string
AppID string
GuildID string
DBHost string
LavalinkHost string
LavalinkPass string
TwitchClientID string
}
func LoadConfig() (*Config, error) {
if err := godotenv.Load(); err != nil {
return nil, err
}
// Load .env if present (e.g. local dev). Ignore if missing (e.g. Docker injects env vars).
_ = godotenv.Load()
token := os.Getenv("BOT_TOKEN")
if token == "" {
@@ -33,9 +32,6 @@ func LoadConfig() (*Config, error) {
}
guildID := os.Getenv("GUILD_ID")
if guildID == "" {
return nil, fmt.Errorf("GUILD_ID is not set")
}
dbHost := os.Getenv("DB_HOST")
if dbHost == "" {