Add Dockerfiles
This commit is contained in:
38
docker/Dockerfile
Normal file
38
docker/Dockerfile
Normal 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
26
docker/Dockerfile.build
Normal 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}
|
||||
Reference in New Issue
Block a user