Skip to content

Commit

Permalink
Merge pull request #2 from langren1353/filebrowser-master
Browse files Browse the repository at this point in the history
Filebrowser master
  • Loading branch information
langren1353 authored Dec 21, 2021
2 parents 212479a + 4670e1f commit 8a70e5c
Show file tree
Hide file tree
Showing 34 changed files with 3,557 additions and 152 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
*
!.docker.json
!docker/*
!filebrowser
59 changes: 53 additions & 6 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,66 @@ on:
pull_request:

jobs:
test:
# linters
# lint-frontend:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v2
# with:
# node-version: '14'
# - run: make lint-frontend
# lint-backend:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-go@v2
# with:
# go-version: 1.17
# - run: make lint-backend
# lint-commints:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# with:
# fetch-depth: 0
# - uses: actions/setup-node@v2
# with:
# node-version: '14'
# - run: make lint-commits
# lint:
# runs-on: ubuntu-latest
# needs: [lint-frontend, lint-backend, lint-commints]
# steps:
# - run: echo "done"

# tests
test-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.16
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: make test
- run: make test-frontend
test-backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.17
- run: make test-backend
test:
runs-on: ubuntu-latest
needs: [test-frontend, test-backend]
steps:
- run: echo "done"

# release
release:
runs-on: ubuntu-latest
# needs: [lint, test]
needs: [test]
if: startsWith(github.event.ref, 'refs/tags/v')
steps:
Expand All @@ -30,7 +77,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.17
- uses: actions/setup-node@v2
with:
node-version: '14'
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
*.db
*.lock
*.bak
_old
rice-box.go
.idea/
filebrowser
filebrowser.exe
/filebrowser
/filebrowser.exe
/dist

.DS_Store
node_modules
Expand Down
22 changes: 11 additions & 11 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ archives:
dockers:
-
dockerfile: Dockerfile
use_buildx: true
use: buildx
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand All @@ -56,10 +56,10 @@ dockers:
- "langren1353/filebrowser-ckplayer:{{ .Tag }}-amd64"
- "langren1353/filebrowser-ckplayer:v{{ .Major }}-amd64"
extra_files:
- .docker.json
- docker/root
-
dockerfile: Dockerfile
use_buildx: true
dockerfile: Dockerfile.aarch64
use: buildx
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand All @@ -74,10 +74,10 @@ dockers:
- "langren1353/filebrowser-ckplayer:{{ .Tag }}-arm64"
- "langren1353/filebrowser-ckplayer:v{{ .Major }}-arm64"
extra_files:
- .docker.json
- docker/root
-
dockerfile: Dockerfile
use_buildx: true
dockerfile: Dockerfile.armhf
use: buildx
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand All @@ -93,10 +93,10 @@ dockers:
- "langren1353/filebrowser-ckplayer:{{ .Tag }}-armv6"
- "langren1353/filebrowser-ckplayer:v{{ .Major }}-armv6"
extra_files:
- .docker.json
- docker/root
-
dockerfile: Dockerfile
use_buildx: true
dockerfile: Dockerfile.armhf
use: buildx
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand All @@ -112,7 +112,7 @@ dockers:
- "langren1353/filebrowser-ckplayer:{{ .Tag }}-armv7"
- "langren1353/filebrowser-ckplayer:v{{ .Major }}-armv7"
extra_files:
- .docker.json
- docker/root
docker_manifests:
- name_template: "langren1353/filebrowser-ckplayer:latest"
image_templates:
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.20.0](https://github.com/filebrowser/filebrowser/compare/v2.19.0...v2.20.0) (2021-12-20)


### Features

* detect multiple subtitle languages ([#1723](https://github.com/filebrowser/filebrowser/issues/1723)) ([c2e03bb](https://github.com/filebrowser/filebrowser/commit/c2e03bbfab97fc6716bcdd59158e9d5129bf0ea7))
* use linuxserver based docker image ([b8f35ce](https://github.com/filebrowser/filebrowser/commit/b8f35ce9322c2b0dbf954cfd3ff584bc9f742fdd))


### Bug Fixes

* set correct default database path in the config ([988d3e5](https://github.com/filebrowser/filebrowser/commit/988d3e5bdd224509ddc2f08444560e3087e9c67d))
* upgrade vulnerable versions of the library ([6eb3ab0](https://github.com/filebrowser/filebrowser/commit/6eb3ab063509a015ad630ab704ae3791461d0982))


### Build

* refactor makefile ([f81857a](https://github.com/filebrowser/filebrowser/commit/f81857acce25936a700945db5ef4af545eaeb1cf))
* remove deprecated goreleaser use_buildx param ([4d1b9dd](https://github.com/filebrowser/filebrowser/commit/4d1b9dd2112002a93bb26cece07dcfd81c31dc2c))

## [2.19.0](https://github.com/filebrowser/filebrowser/compare/v2.18.0...v2.19.0) (2021-11-24)


Expand Down
15 changes: 8 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
FROM alpine:latest
FROM ghcr.io/linuxserver/baseimage-alpine:3.14

RUN apk --update add ca-certificates \
mailcap \
curl

HEALTHCHECK --start-period=2s --interval=5s --timeout=3s \
CMD curl -f http://localhost/health || exit 1

VOLUME /srv
EXPOSE 80

COPY .docker.json /.filebrowser.json
COPY filebrowser /filebrowser
# copy local files
COPY docker/root/ /
COPY filebrowser /usr/bin/filebrowser

ENTRYPOINT [ "/filebrowser" ]
# ports and volumes
VOLUME /srv /config /database
EXPOSE 80
16 changes: 16 additions & 0 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.14

RUN apk --update add ca-certificates \
mailcap \
curl

HEALTHCHECK --start-period=2s --interval=5s --timeout=3s \
CMD curl -f http://localhost/health || exit 1

# copy local files
COPY docker/root/ /
COPY filebrowser /usr/bin/filebrowser

# ports and volumes
VOLUME /srv /config /database
EXPOSE 80
16 changes: 16 additions & 0 deletions Dockerfile.armhf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM ghcr.io/linuxserver/baseimage-alpine:arm32v7-3.14

RUN apk --update add ca-certificates \
mailcap \
curl

HEALTHCHECK --start-period=2s --interval=5s --timeout=3s \
CMD curl -f http://localhost/health || exit 1

# copy local files
COPY docker/root/ /
COPY filebrowser /usr/bin/filebrowser

# ports and volumes
VOLUME /srv /config /database
EXPOSE 80
104 changes: 39 additions & 65 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,94 +1,68 @@
SHELL := /bin/bash
BASE_PATH := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
VERSION ?= $(shell git describe --tags --always --match=v* 2> /dev/null || \
cat $(CURDIR)/.version 2> /dev/null || echo v0)
VERSION_HASH = $(shell git rev-parse HEAD)

BIN = $(BASE_PATH)/bin
PATH := $(BIN):$(PATH)
export PATH

# printing
V = 0
Q = $(if $(filter 1,$V),,@)
M = $(shell printf "\033[34;1m▶\033[0m")

GO = GOGC=off go
# go module
MODULE = $(shell env GO111MODULE=on $(GO) list -m)

DATE ?= $(shell date +%FT%T%z)
VERSION ?= $(shell git describe --tags --always --match=v* 2> /dev/null || \
cat $(CURDIR)/.version 2> /dev/null || echo v0)
VERSION_HASH = $(shell git rev-parse --short HEAD)
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
include common.mk
include tools.mk

LDFLAGS += -X "$(MODULE)/version.Version=$(VERSION)" -X "$(MODULE)/version.CommitSHA=$(VERSION_HASH)"

# tools
$(BIN):
@mkdir -p $@
$(BIN)/%: | $(BIN) ; $(info $(M) installing $(PACKAGE)…)
$Q env GOBIN=$(BIN) $(GO) install $(PACKAGE)
## Build:

GOLANGCI_LINT = $(BIN)/golangci-lint
$(BIN)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/cmd/golangci-lint@v1.41.1

GOIMPORTS = $(BIN)/goimports
$(BIN)/goimports: PACKAGE=golang.org/x/tools/cmd/goimports@v0.1.5

## build: Build
.PHONY: build
build: | build-frontend build-backend ; $(info $(M) building…)
build: | build-frontend build-backend ## Build binary

## build-frontend: Build frontend
.PHONY: build-frontend
build-frontend: | ; $(info $(M) building frontend…)
build-frontend: ## Build frontend
$Q cd frontend && yarn && npm run build

## build-backend: Build backend
.PHONY: build-backend
build-backend: | ; $(info $(M) building backend…)
$Q $(GO) build -ldflags '$(LDFLAGS)' -o .
build-backend: ## Build backend
$Q $(go) build -ldflags '$(LDFLAGS)' -o .

## test: Run all tests
.PHONY: test
test: | test-frontend test-backend ; $(info $(M) running tests…)
test: | test-frontend test-backend ## Run all tests

## test-frontend: Run frontend tests
.PHONY: test-frontend
test-frontend: | ; $(info $(M) running frontend tests…)
test-frontend: ## Run frontend tests

## test-backend: Run backend tests
.PHONY: test-backend
test-backend: | ; $(info $(M) running backend tests…)
$Q $(GO) test -v ./...
test-backend: ## Run backend tests
$Q $(go) test -v ./...

## lint: Lint
.PHONY: lint
lint: lint-frontend lint-backend lint-commits | ; $(info $(M) running all linters…)
lint: lint-frontend lint-backend lint-commits ## Run all linters

## lint-frontend: Lint frontend
.PHONY: lint-frontend
lint-frontend: | ; $(info $(M) running frontend linters…)
$Q cd frontend && npm ci && npm run lint
lint-frontend: ## Run frontend linters
$Q cd frontend && yarn && npm run lint

## lint-backend: Lint backend
.PHONY: lint-backend
lint-backend: | $(GOLANGCI_LINT) ; $(info $(M) running backend linters…)
$Q $(GOLANGCI_LINT) run
lint-backend: | $(golangci-lint) ## Run backend linters
$Q $(golangci-lint) run -v

## lint-commits: Lint commits
.PHONY: lint-commits
lint-commits: | ; $(info $(M) running commitlint…)
lint-commits: $(commitlint) ## Run commit linters
$Q ./scripts/commitlint.sh

## bump-version: Bump app version
fmt: $(goimports) ## Format source files
$Q $(goimports) -local $(MODULE) -w $$(find . -type f -name '*.go' -not -path "./vendor/*")

clean: clean-tools ## Clean

## Release:

.PHONY: bump-version
bump-version: | ; $(info $(M) creating a new release…)
bump-version: $(standard-version) ## Bump app version
$Q ./scripts/bump_version.sh

## help: Show this help
.PHONY: help
help:
@sed -n 's/^## //p' $(MAKEFILE_LIST) | column -t -s ':' | sed -e 's/^/ /' | sort
## Help:
help: ## Show this help
@echo ''
@echo 'Usage:'
@echo ' ${YELLOW}make${RESET} ${GREEN}<target> [options]${RESET}'
@echo ''
@echo 'Options:'
@$(call global_option, "V [0|1]", "enable verbose mode (default:0)")
@echo ''
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*?## "} { \
if (/^[a-zA-Z_-]+:.*?##.*$$/) {printf " ${YELLOW}%-20s${GREEN}%s${RESET}\n", $$1, $$2} \
else if (/^## .*$$/) {printf " ${CYAN}%s${RESET}\n", substr($$1,4)} \
}' $(MAKEFILE_LIST)
Loading

0 comments on commit 8a70e5c

Please sign in to comment.