Add Dockerfiles

This commit is contained in:
2025-09-21 02:35:05 -05:00
parent 5a0c70190f
commit a8d78d2784
2 changed files with 64 additions and 0 deletions

38
docker/Dockerfile Normal file
View File

@@ -0,0 +1,38 @@
FROM golang:1.24-alpine AS builder
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
RUN apk add --no-cache git
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY cmd/ cmd/
COPY internal/ internal/
COPY pkg/ pkg/
RUN go build \
-ldflags='-w -s -extldflags "-static"' \
-a -installsuffix cgo \
-o reticulum-go \
./cmd/reticulum-go
FROM busybox:latest
RUN adduser -D -s /bin/sh app
COPY --from=builder /build/reticulum-go /usr/local/bin/reticulum-go
RUN chmod +x /usr/local/bin/reticulum-go
RUN mkdir -p /app && chown app:app /app
USER app
WORKDIR /app
EXPOSE 4242
ENTRYPOINT ["/usr/local/bin/reticulum-go"]

26
docker/Dockerfile.build Normal file
View File

@@ -0,0 +1,26 @@
FROM golang:1.24-alpine
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
RUN apk add --no-cache git
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY cmd/ cmd/
COPY internal/ internal/
COPY pkg/ pkg/
ARG BINARY_NAME=reticulum-go
ARG BUILD_PATH=./cmd/reticulum-go
RUN mkdir -p /dist && \
go build \
-ldflags='-w -s -extldflags "-static"' \
-a -installsuffix cgo \
-o /dist/${BINARY_NAME} \
${BUILD_PATH}