feat: build multi-arch docker images

This commit is contained in:
Oleg Lobanov 2021-03-03 13:46:22 +01:00
parent e8c9d1c539
commit cf4836dc75
No known key found for this signature in database
GPG Key ID: 7CC64E41212621B0
6 changed files with 102 additions and 86 deletions

View File

@ -1,8 +0,0 @@
{
"port": 80,
"baseURL": "",
"address": "",
"log": "stdout",
"database": "/database.db",
"root": "/srv"
}

View File

@ -1,3 +1,2 @@
testdata/ *
.github/ !filebrowser
**.git

View File

@ -19,10 +19,6 @@ build:
- linux - linux
- windows - windows
- freebsd - freebsd
- netbsd
- openbsd
- dragonfly
- solaris
goarch: goarch:
- amd64 - amd64
- 386 - 386
@ -35,14 +31,8 @@ build:
ignore: ignore:
- goos: darwin - goos: darwin
goarch: 386 goarch: 386
- goos: openbsd
goarch: arm
- goos: freebsd - goos: freebsd
goarch: arm goarch: arm
- goos: netbsd
goarch: arm
- goos: solaris
goarch: arm
archives: archives:
- -
@ -55,53 +45,86 @@ archives:
dockers: dockers:
- -
dockerfile: Dockerfile dockerfile: Dockerfile
binaries: use_buildx: true
- filebrowser build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/amd64"
goos: linux goos: linux
goarch: amd64 goarch: amd64
goarm: ''
image_templates: image_templates:
- "filebrowser/filebrowser:latest" - "filebrowser/filebrowser:{{ .Tag }}-amd64"
- "filebrowser/filebrowser:{{ .Tag }}" - "filebrowser/filebrowser:v{{ .Major }}-amd64"
- "filebrowser/filebrowser:v{{ .Major }}"
extra_files:
- .docker.json
- -
dockerfile: Dockerfile dockerfile: Dockerfile
binaries: use_buildx: true
- filebrowser build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/arm64"
goos: linux
goarch: arm64
image_templates:
- "filebrowser/filebrowser:{{ .Tag }}-arm64"
- "filebrowser/filebrowser:v{{ .Major }}-arm64"
-
dockerfile: Dockerfile
use_buildx: true
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/arm/v6"
goos: linux goos: linux
goarch: arm goarch: arm
goarm: '5' goarm: '6'
image_templates: image_templates:
- "filebrowser/filebrowser:pi" - "filebrowser/filebrowser:{{ .Tag }}-armv6"
- "filebrowser/filebrowser:{{ .Tag }}-pi" - "filebrowser/filebrowser:v{{ .Major }}-armv6"
- "filebrowser/filebrowser:v{{ .Major }}-pi"
extra_files:
- .docker.json
- -
dockerfile: Dockerfile.alpine dockerfile: Dockerfile
binaries: use_buildx: true
- filebrowser build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/arm/v7"
goos: linux goos: linux
goarch: amd64 goarch: arm
goarm: '' goarm: '7'
image_templates: image_templates:
- "filebrowser/filebrowser:alpine" - "filebrowser/filebrowser:{{ .Tag }}-armv7"
- "filebrowser/filebrowser:{{ .Tag }}-alpine" - "filebrowser/filebrowser:v{{ .Major }}-armv7"
- "filebrowser/filebrowser:v{{ .Major }}-alpine" docker_manifests:
extra_files: - name_template: "filebrowser/filebrowser:latest"
- .docker.json
-
dockerfile: Dockerfile.debian
binaries:
- filebrowser
goos: linux
goarch: amd64
goarm: ''
image_templates: image_templates:
- "filebrowser/filebrowser:debian" - "filebrowser/filebrowser:{{ .Tag }}-amd64"
- "filebrowser/filebrowser:{{ .Tag }}-debian" - "filebrowser/filebrowser:{{ .Tag }}-arm64"
- "filebrowser/filebrowser:v{{ .Major }}-debian" - "filebrowser/filebrowser:{{ .Tag }}-armv6"
extra_files: - "filebrowser/filebrowser:{{ .Tag }}-armv7"
- .docker.json - name_template: "filebrowser/filebrowser:{{ .Tag }}"
image_templates:
- "filebrowser/filebrowser:{{ .Tag }}-amd64"
- "filebrowser/filebrowser:{{ .Tag }}-arm64"
- "filebrowser/filebrowser:{{ .Tag }}-armv6"
- "filebrowser/filebrowser:{{ .Tag }}-armv7"
- name_template: "filebrowser/filebrowser:{{ .Major }}"
image_templates:
- "filebrowser/filebrowser:{{ .Major }}-amd64"
- "filebrowser/filebrowser:{{ .Major }}-arm64"
- "filebrowser/filebrowser:{{ .Major }}-armv6"
- "filebrowser/filebrowser:{{ .Major }}-armv7"

View File

@ -1,15 +1,37 @@
FROM alpine:latest as alpine FROM alpine:latest
RUN apk --update add ca-certificates RUN apk --update add ca-certificates
RUN apk --update add mailcap RUN apk --update add mailcap
FROM scratch
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=alpine /etc/mime.types /etc/mime.types
VOLUME /srv VOLUME /srv
EXPOSE 80 EXPOSE 80
COPY .docker.json /.filebrowser.json
COPY filebrowser /filebrowser COPY filebrowser /filebrowser
# Create appuser.
ENV USER=root
ENV GROUP=root
ENV UID=0
ENV GID=0
ENV UMASK=022
RUN if [ "$GID" -ne 0 ]; then \
addgroup \
-g "${GID}" \
"${GROUP}" ; \
fi;
RUN adduser \
-g "" \
-D \
-G "${GROUP}" \
-H \
-h "/nonexistent" \
-s "/sbin/nologin" \
-u "${UID}" \
"${USER}"
USER ${USER}:${GROUP}
RUN umask ${UMASK}
ENTRYPOINT [ "/filebrowser" ] ENTRYPOINT [ "/filebrowser" ]

View File

@ -1,11 +0,0 @@
FROM alpine:latest as alpine
RUN apk --update add ca-certificates
RUN apk --update add mailcap
VOLUME /srv
EXPOSE 80
COPY .docker.json /.filebrowser.json
COPY filebrowser /filebrowser
ENTRYPOINT [ "/filebrowser" ]

View File

@ -1,9 +0,0 @@
FROM debian:buster
VOLUME /srv
EXPOSE 80
COPY .docker.json /.filebrowser.json
COPY filebrowser /filebrowser
ENTRYPOINT [ "/filebrowser" ]