Updated the Dockerfile to reflect best practices; removed the dropreplace lines after updates to go.mod.
All checks were successful
ci/woodpecker/manual/build-image Pipeline was successful

This commit is contained in:
2026-02-01 16:59:34 -06:00
parent e86d4a02e0
commit df3f42ef30
4 changed files with 14 additions and 11 deletions

8
.dockerignore Normal file
View File

@@ -0,0 +1,8 @@
.git
.gitignore
**/*_test.go
**/*.md
dist/
tmp/
.DS_Store

View File

@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.6 # syntax=docker/dockerfile:1.6
ARG GO_VERSION=1.22 ARG GO_VERSION=1.25
############################ ############################
# Build stage # Build stage
@@ -16,26 +16,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# Cache dependencies first # Cache dependencies first
COPY go.mod go.sum ./ COPY go.mod go.sum ./
RUN go mod edit -dropreplace gitea.maximumdirect.net/ejr/feedkit
RUN --mount=type=cache,target=/go/pkg/mod \ RUN --mount=type=cache,target=/go/pkg/mod \
go mod download go mod download
# Copy the rest of the source # Copy the rest of the source
COPY . . COPY . .
# Remove local dev replaces that don't exist in container context
RUN go mod edit -dropreplace gitea.maximumdirect.net/ejr/feedkit
# Ensure go.sum is complete after dropping the replace # Ensure go.sum is complete after dropping the replace
RUN --mount=type=cache,target=/go/pkg/mod \ RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \ --mount=type=cache,target=/root/.cache/go-build
go mod tidy
# Default to a static build (no CGO) # Default to a static build (no CGO)
# If errors, can build with: --build-arg CGO_ENABLED=1 # If errors, can build with: --build-arg CGO_ENABLED=1
ARG CGO_ENABLED=0 ARG CGO_ENABLED=0
ARG TARGETOS=linux ARG TARGETOS=linux
ARG TARGETARCH ARG TARGETARCH=amd64
ENV CGO_ENABLED=${CGO_ENABLED} \ ENV CGO_ENABLED=${CGO_ENABLED} \
GOOS=${TARGETOS} \ GOOS=${TARGETOS} \
GOARCH=${TARGETARCH} GOARCH=${TARGETARCH}

4
go.mod
View File

@@ -1,9 +1,7 @@
module gitea.maximumdirect.net/ejr/weatherfeeder module gitea.maximumdirect.net/ejr/weatherfeeder
go 1.22 go 1.25
require gitea.maximumdirect.net/ejr/feedkit v0.4.0 require gitea.maximumdirect.net/ejr/feedkit v0.4.0
require gopkg.in/yaml.v3 v3.0.1 // indirect require gopkg.in/yaml.v3 v3.0.1 // indirect
replace gitea.maximumdirect.net/ejr/feedkit => ../feedkit

2
go.sum
View File

@@ -1,3 +1,5 @@
gitea.maximumdirect.net/ejr/feedkit v0.4.0 h1:6sXr+eMCZZd+tHtzTjYpYoq6qFZ20QlsB51h57sWFpM=
gitea.maximumdirect.net/ejr/feedkit v0.4.0/go.mod h1:+oKPs8gYsY+iBm06uXjj6BbAQzttKi0uCenNUyLoGzg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=