Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ docker/*
.github/*
test/*
out/*
target/*
site/*
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
file: docker/Dockerfile.backend
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
54 changes: 54 additions & 0 deletions docker/Dockerfile.backend
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#######################
# Docker.backend
#
# Author: Andrei Tumbar
# Brief: Build the Hermes code
#
#######################

############################################################
# Backend build stage
############################################################
FROM golang:1.26-alpine AS builder-backend

# Install build dependencies
RUN apk add --no-cache git make

WORKDIR /build

# Copy go mod files first for better caching
COPY go.mod go.sum ./
RUN go mod download

# Copy source code
COPY . .

# Build the backend binary
RUN CGO_ENABLED=0 GOOS=linux go build -o backend ./cmd/backend

############################################################
# Runtime stage
############################################################
FROM alpine

# Install runtime dependencies
RUN apk add --no-cache ca-certificates tzdata

WORKDIR /app

# Copy backend binary from builder
COPY --from=builder-backend /build/backend /app/backend

# Create directories for config and data
RUN mkdir -p /app/config /app/data

EXPOSE 6880

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD ["/app/backend", "--help"] || exit 1

RUN /app/backend --generate-config > /app/config/hermes.toml

ENTRYPOINT ["/app/backend"]
CMD ["--bind", "0.0.0.0:6880", "--config", "app/config/hermes.toml", "--root", "/app/data", "--verbose"]
Loading