diff --git a/.docker.json b/.docker.json deleted file mode 100644 index 8e7472df..00000000 --- a/.docker.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "port": 80, - "baseURL": "", - "address": "", - "log": "stdout", - "database": "/database.db", - "root": "/srv" -} diff --git a/.dockerignore b/.dockerignore index 8767564e..60b7a312 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,2 @@ -testdata/ -.github/ -**.git +* +!filebrowser \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml index 5d56ed0f..4220a338 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -19,10 +19,6 @@ build: - linux - windows - freebsd - - netbsd - - openbsd - - dragonfly - - solaris goarch: - amd64 - 386 @@ -35,14 +31,8 @@ build: ignore: - goos: darwin goarch: 386 - - goos: openbsd - goarch: arm - goos: freebsd goarch: arm - - goos: netbsd - goarch: arm - - goos: solaris - goarch: arm archives: - @@ -55,53 +45,86 @@ archives: dockers: - dockerfile: Dockerfile - binaries: - - filebrowser + 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/amd64" goos: linux goarch: amd64 - goarm: '' image_templates: - - "filebrowser/filebrowser:latest" - - "filebrowser/filebrowser:{{ .Tag }}" - - "filebrowser/filebrowser:v{{ .Major }}" - extra_files: - - .docker.json + - "filebrowser/filebrowser:{{ .Tag }}-amd64" + - "filebrowser/filebrowser:v{{ .Major }}-amd64" - dockerfile: Dockerfile - binaries: - - filebrowser + 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/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 goarch: arm - goarm: '5' + goarm: '6' image_templates: - - "filebrowser/filebrowser:pi" - - "filebrowser/filebrowser:{{ .Tag }}-pi" - - "filebrowser/filebrowser:v{{ .Major }}-pi" - extra_files: - - .docker.json + - "filebrowser/filebrowser:{{ .Tag }}-armv6" + - "filebrowser/filebrowser:v{{ .Major }}-armv6" - - dockerfile: Dockerfile.alpine - binaries: - - filebrowser + 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/v7" goos: linux - goarch: amd64 - goarm: '' + goarch: arm + goarm: '7' image_templates: - - "filebrowser/filebrowser:alpine" - - "filebrowser/filebrowser:{{ .Tag }}-alpine" - - "filebrowser/filebrowser:v{{ .Major }}-alpine" - extra_files: - - .docker.json - - - dockerfile: Dockerfile.debian - binaries: - - filebrowser - goos: linux - goarch: amd64 - goarm: '' + - "filebrowser/filebrowser:{{ .Tag }}-armv7" + - "filebrowser/filebrowser:v{{ .Major }}-armv7" +docker_manifests: + - name_template: "filebrowser/filebrowser:latest" image_templates: - - "filebrowser/filebrowser:debian" - - "filebrowser/filebrowser:{{ .Tag }}-debian" - - "filebrowser/filebrowser:v{{ .Major }}-debian" - extra_files: - - .docker.json + - "filebrowser/filebrowser:{{ .Tag }}-amd64" + - "filebrowser/filebrowser:{{ .Tag }}-arm64" + - "filebrowser/filebrowser:{{ .Tag }}-armv6" + - "filebrowser/filebrowser:{{ .Tag }}-armv7" + - 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" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 549bd136..ab6b0b38 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,37 @@ -FROM alpine:latest as alpine +FROM alpine:latest RUN apk --update add ca-certificates 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 EXPOSE 80 -COPY .docker.json /.filebrowser.json COPY filebrowser /filebrowser -ENTRYPOINT [ "/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" ] \ No newline at end of file diff --git a/Dockerfile.alpine b/Dockerfile.alpine deleted file mode 100644 index e5d35107..00000000 --- a/Dockerfile.alpine +++ /dev/null @@ -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" ] diff --git a/Dockerfile.debian b/Dockerfile.debian deleted file mode 100644 index 42f120d5..00000000 --- a/Dockerfile.debian +++ /dev/null @@ -1,9 +0,0 @@ -FROM debian:buster - -VOLUME /srv -EXPOSE 80 - -COPY .docker.json /.filebrowser.json -COPY filebrowser /filebrowser - -ENTRYPOINT [ "/filebrowser" ]