fix build and docker-compose
This commit is contained in:
parent
4af6fc14c5
commit
cd2631787a
12
.dockerignore
Normal file
12
.dockerignore
Normal file
@ -0,0 +1,12 @@
|
||||
store
|
||||
builds
|
||||
|
||||
.env
|
||||
.env.example
|
||||
|
||||
Makefile
|
||||
README.md
|
||||
|
||||
docker-*.yml
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,4 +1,6 @@
|
||||
builds
|
||||
store
|
||||
|
||||
.env
|
||||
.env
|
||||
|
||||
*.tar
|
||||
181
.golangci.yml
181
.golangci.yml
@ -1,133 +1,100 @@
|
||||
linters-settings:
|
||||
# depguard: // Specific for golangci repository
|
||||
# list-type: blacklist
|
||||
# packages:
|
||||
# # logging is allowed only by logutils.Log, logrus
|
||||
# # is allowed to use only in logutils package
|
||||
# - github.com/sirupsen/logrus
|
||||
# packages-with-error-message:
|
||||
# - github.com/sirupsen/logrus: 'logging is allowed only by logutils.Log'
|
||||
dupl:
|
||||
threshold: 100
|
||||
funlen:
|
||||
lines: 100
|
||||
statements: 50
|
||||
gci:
|
||||
sections:
|
||||
prefix(fetchsysd)
|
||||
goconst:
|
||||
min-len: 2
|
||||
min-occurrences: 2
|
||||
gocritic:
|
||||
enabled-tags:
|
||||
- diagnostic
|
||||
- experimental
|
||||
- opinionated
|
||||
- performance
|
||||
- style
|
||||
disabled-checks:
|
||||
- dupImport # https://github.com/go-critic/go-critic/issues/845
|
||||
- ifElseChain
|
||||
- octalLiteral
|
||||
# - whyNoLint
|
||||
- wrapperFunc
|
||||
gocyclo:
|
||||
min-complexity: 15
|
||||
goimports:
|
||||
local-prefixes: localenv
|
||||
mnd:
|
||||
# don't include the "operation" and "assign"
|
||||
checks:
|
||||
- argument
|
||||
- case
|
||||
- condition
|
||||
- return
|
||||
govet:
|
||||
shadow: true
|
||||
# settings: // Specific for golangci repository
|
||||
# printf:
|
||||
# funcs:
|
||||
# - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
|
||||
# - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
|
||||
# - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
|
||||
# - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
|
||||
lll:
|
||||
line-length: 200
|
||||
maligned:
|
||||
suggest-new: true
|
||||
misspell:
|
||||
locale: US
|
||||
nolintlint:
|
||||
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
|
||||
allow-unused: false # report any unused nolint directives
|
||||
require-explanation: false # don't require an explanation for nolint directives
|
||||
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
|
||||
errcheck:
|
||||
check-blank: true
|
||||
exclude-functions:
|
||||
- '(*github.com/gin-gonic/gin.Error).SetType'
|
||||
- '(*github.com/gin-gonic/gin.Context).Error'
|
||||
|
||||
version: "2"
|
||||
linters:
|
||||
disable-all: true
|
||||
default: none
|
||||
enable:
|
||||
- bodyclose
|
||||
# - deadcode # deprecated (since v1.49.0)
|
||||
# - depguard
|
||||
- copyloopvar
|
||||
- dogsled
|
||||
- dupl
|
||||
- errcheck
|
||||
- copyloopvar
|
||||
- exhaustive
|
||||
- funlen
|
||||
- gochecknoinits
|
||||
- goconst
|
||||
- gocritic
|
||||
- gocyclo
|
||||
- gofmt
|
||||
- goimports
|
||||
- mnd
|
||||
- goprintffuncname
|
||||
- gosec
|
||||
- gosimple
|
||||
- govet
|
||||
- ineffassign
|
||||
- lll
|
||||
- misspell
|
||||
- mnd
|
||||
- nakedret
|
||||
- noctx
|
||||
- nolintlint
|
||||
# - rowserrcheck # https://github.com/golangci/golangci-lint/issues/2649
|
||||
- staticcheck
|
||||
# - structcheck # https://github.com/golangci/golangci-lint/issues/2649
|
||||
- stylecheck
|
||||
- typecheck
|
||||
- unconvert
|
||||
- unparam
|
||||
- unused
|
||||
# - varcheck # deprecated (since v1.49.0)
|
||||
- whitespace
|
||||
# - gochecknoglobals # too many global in ds9
|
||||
|
||||
# don't enable:
|
||||
# - asciicheck
|
||||
# - scopelint
|
||||
# - gocognit
|
||||
# - godot
|
||||
# - godox
|
||||
# - goerr113
|
||||
# - interfacer
|
||||
# - maligned
|
||||
# - nestif
|
||||
# - prealloc
|
||||
# - testpackage
|
||||
# - revive
|
||||
# - wsl
|
||||
|
||||
# issues:
|
||||
# Excluding configuration per-path, per-linter, per-text and per-source
|
||||
# fix: true
|
||||
|
||||
run:
|
||||
timeout: 5m
|
||||
skip-dirs: []
|
||||
settings:
|
||||
dupl:
|
||||
threshold: 100
|
||||
errcheck:
|
||||
check-blank: true
|
||||
exclude-functions:
|
||||
- (*github.com/gin-gonic/gin.Error).SetType
|
||||
- (*github.com/gin-gonic/gin.Context).Error
|
||||
funlen:
|
||||
lines: 100
|
||||
statements: 50
|
||||
goconst:
|
||||
min-len: 2
|
||||
min-occurrences: 2
|
||||
gocritic:
|
||||
disabled-checks:
|
||||
- dupImport
|
||||
- ifElseChain
|
||||
- octalLiteral
|
||||
- wrapperFunc
|
||||
enabled-tags:
|
||||
- diagnostic
|
||||
- experimental
|
||||
- opinionated
|
||||
- performance
|
||||
- style
|
||||
gocyclo:
|
||||
min-complexity: 15
|
||||
lll:
|
||||
line-length: 200
|
||||
misspell:
|
||||
locale: US
|
||||
mnd:
|
||||
checks:
|
||||
- argument
|
||||
- case
|
||||
- condition
|
||||
- return
|
||||
nolintlint:
|
||||
require-explanation: false
|
||||
require-specific: false
|
||||
allow-unused: false
|
||||
exclusions:
|
||||
generated: lax
|
||||
presets:
|
||||
- comments
|
||||
- common-false-positives
|
||||
- legacy
|
||||
- std-error-handling
|
||||
paths:
|
||||
- third_party$
|
||||
- builtin$
|
||||
- examples$
|
||||
formatters:
|
||||
enable:
|
||||
- gofmt
|
||||
- goimports
|
||||
settings:
|
||||
gci:
|
||||
sections:
|
||||
- prefix(fetchsysd)
|
||||
goimports:
|
||||
local-prefixes:
|
||||
- localenv
|
||||
exclusions:
|
||||
generated: lax
|
||||
paths:
|
||||
- third_party$
|
||||
- builtin$
|
||||
- examples$
|
||||
|
||||
22
Dockerfile
Normal file
22
Dockerfile
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
FROM golang:1.22 AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN GOOS=linux go build -o librapi main.go
|
||||
|
||||
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/librapi .
|
||||
RUN chmod +x /app/librapi
|
||||
RUN mkdir -p /app/store
|
||||
|
||||
CMD ["./librapi"]
|
||||
4
Makefile
4
Makefile
@ -8,5 +8,5 @@ build: lint
|
||||
lint:
|
||||
golangci-lint run --fix
|
||||
|
||||
run: lint
|
||||
go run main.go
|
||||
run: lint build
|
||||
docker compose up
|
||||
16
docker-compose.yml
Normal file
16
docker-compose.yml
Normal file
@ -0,0 +1,16 @@
|
||||
services:
|
||||
librapi:
|
||||
image: librapi:local
|
||||
container_name: librapi
|
||||
env_file:
|
||||
- .env
|
||||
ports:
|
||||
- "8080:8080"
|
||||
networks:
|
||||
- librapi_network
|
||||
volumes:
|
||||
- ./store:/app/store:rw
|
||||
|
||||
networks:
|
||||
librapi_network:
|
||||
driver: bridge
|
||||
Loading…
x
Reference in New Issue
Block a user