Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.git
.github
bin
vendor
docs
*.md
*.test
*.out
__debug_bin*
log.txt
.env
.claude
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ __debug_bin*
# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
# Dependency directories
vendor/

# Go workspace file
go.work
34 changes: 16 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
# Dockerfile References: https://docs.docker.com/engine/reference/builder/
# Build stage
FROM golang:1.24.0 AS builder

# Start from the latest golang base image
FROM golang:1.24.0

# Add Maintainer Info
LABEL maintainer="Nadir Hamid <matrix.nad@gmail.com>"

ENV RUN_AS=distributor

# Set the Current Working Directory inside the container
WORKDIR /app

# Copy go mod and sum files
COPY go.mod go.sum ./

# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
RUN go mod download

# Copy the source from the current directory to the Working Directory inside the container
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o bin/distributor ./cmd/distributor/main.go && \
CGO_ENABLED=0 GOOS=linux go build -o bin/worker ./cmd/worker/main.go && \
CGO_ENABLED=0 GOOS=linux go build -o bin/cli ./cmd/cli/main.go

# Build the Go app
#RUN go build -o main .
RUN make build
# Runtime stage
FROM alpine:3.20

# Command to run the executable
RUN apk add --no-cache bash ca-certificates

WORKDIR /app

COPY --from=builder /app/bin/ ./bin/
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh

ENV RUN_AS=distributor

ENTRYPOINT ["./entrypoint.sh"]
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ SHELL:=/bin/sh
# Variables
BINARY_DIR=bin
DISTRIBUTOR_BINARY=$(BINARY_DIR)/distributor
BILLING_WORKER_BINARY=$(BINARY_DIR)/worker-billing
RECORDINGS_WORKER_BINARY=$(BINARY_DIR)/worker-recordings
WORKER_BINARY=$(BINARY_DIR)/worker
CLI_BINARY=$(BINARY_DIR)/cli

.PHONY: help
help: # Show help for each of the Makefile recipes.
Expand All @@ -19,21 +19,21 @@ help: # Show help for each of the Makefile recipes.
all: build # Build both distributor and worker binaries

.PHONY: build
build: # Build both distributor and worker binaries
build: # Build all binaries (distributor, worker, CLI)
@echo "Building binaries..."
mkdir -p $(BINARY_DIR)
go build -o $(DISTRIBUTOR_BINARY) ./cmd/distributor/main.go
go build -o $(BILLING_WORKER_BINARY) ./cmd/worker-billing/main.go
go build -o $(RECORDINGS_WORKER_BINARY) ./cmd/worker-recordings/main.go
go build -o $(WORKER_BINARY) ./cmd/worker/main.go
go build -o $(CLI_BINARY) ./cmd/cli/main.go
@echo "Binaries available in ./bin"

.PHONY: run-distributor
run-distributor: # Runs the distributor locally using go run
go run -race ./cmd/distributor/main.go

.PHONY: run-billing-worker
run-billing-worker: # Runs the billing worker locally using go run
go run -race ./cmd/worker-billing/main.go
.PHONY: run-worker
run-worker: # Runs the unified worker locally using go run
go run -race ./cmd/worker/main.go

########################################################################################################################
##@ Setup
Expand Down
160 changes: 0 additions & 160 deletions cmd/annual_billing.go

This file was deleted.

Loading