Skip to content

Commit

Permalink
Improve Dockerfiles
Browse files Browse the repository at this point in the history
- Specify Docker registry explicitly (e.g., Podman does not use
  `docker.io` by default)
- Use `make miniflux` instead of duplicating `go build` arguments (this
  leverages Go's PIE build mode)
- Enable cgo to fix ARM containers (we need to make sure to use the same
  OS version for both container stages to avoid libc issues)
  • Loading branch information
michaelkuhn authored and fguillot committed Apr 5, 2024
1 parent 11fd1c9 commit 194f517
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
12 changes: 4 additions & 8 deletions packaging/docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
FROM golang:alpine AS build
ENV CGO_ENABLED=0
RUN apk add --no-cache --update git
FROM docker.io/library/golang:alpine3.19 AS build
RUN apk add --no-cache build-base git make
ADD . /go/src/app
WORKDIR /go/src/app
RUN go build \
-o miniflux \
-ldflags="-s -w -X 'miniflux.app/v2/internal/version.Version=`git describe --tags --abbrev=0`' -X 'miniflux.app/v2/internal/version.Commit=`git rev-parse --short HEAD`' -X 'miniflux.app/v2/internal/version.BuildDate=`date +%FT%T%z`'" \
main.go
RUN make miniflux

FROM alpine:latest
FROM docker.io/library/alpine:3.19

LABEL org.opencontainers.image.title=Miniflux
LABEL org.opencontainers.image.description="Miniflux is a minimalist and opinionated feed reader"
Expand Down
10 changes: 3 additions & 7 deletions packaging/docker/distroless/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
FROM golang:latest AS build
ENV CGO_ENABLED=0
FROM docker.io/library/golang:bookworm AS build
ADD . /go/src/app
WORKDIR /go/src/app
RUN go build \
-o miniflux \
-ldflags="-s -w -X 'miniflux.app/v2/internal/version.Version=`git describe --tags --abbrev=0`' -X 'miniflux.app/v2/internal/version.Commit=`git rev-parse --short HEAD`' -X 'miniflux.app/v2/internal/version.BuildDate=`date +%FT%T%z`'" \
main.go
RUN make miniflux

FROM gcr.io/distroless/base:nonroot
FROM gcr.io/distroless/base-debian12:nonroot

LABEL org.opencontainers.image.title=Miniflux
LABEL org.opencontainers.image.description="Miniflux is a minimalist and opinionated feed reader"
Expand Down

0 comments on commit 194f517

Please sign in to comment.