Skip to content

Commit

Permalink
chore: 馃敡 Changes that do not modify src or test files
Browse files Browse the repository at this point in the history
  • Loading branch information
tarampampam committed Feb 23, 2023
1 parent 5343d8c commit b84b3ba
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 37 deletions.
23 changes: 9 additions & 14 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
.dockerignore
Dockerfile
.github
.git
.gitignore
.editorconfig
.idea
.vscode
test
temp
tmp
LICENSE
Makefile
error-pages
## Ignore everything
*

## Except the following files and directories
!/cmd
!/internal
!/templates
!/error-pages.yml
!/go.*
5 changes: 1 addition & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.{yml, yaml, sh, conf, json}]
indent_size = 2
trim_trailing_whitespace = true

[{Makefile, go.mod, *.go}]
indent_style = tab
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Makefile readme (en): <https://www.gnu.org/software/make/manual/html_node/index.html#SEC_Contents>

SHELL = /bin/sh
LDFLAGS = "-s -w -X github.com/tarampampam/error-pages/internal/version.version=$(shell git rev-parse HEAD)"
LDFLAGS = "-s -w -X gh.tarampamp.am/error-pages/internal/version.version=$(shell git rev-parse HEAD)"

DC_RUN_ARGS = --rm --user "$(shell id -u):$(shell id -g)"
APP_NAME = $(notdir $(CURDIR))
Expand Down
15 changes: 1 addition & 14 deletions cmd/error-pages/main.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
package main

import (
crypto "crypto/rand"
"encoding/binary"
"math/rand"
"os"
"path/filepath"
"time"

"github.com/fatih/color"
"go.uber.org/automaxprocs/maxprocs"

"github.com/tarampampam/error-pages/internal/cli"
"gh.tarampamp.am/error-pages/internal/cli"
)

// set GOMAXPROCS to match Linux container CPU quota.
Expand All @@ -26,15 +22,6 @@ func main() { exitFn(run()) }
// run this CLI application.
// Exit codes documentation: <https://tldp.org/LDP/abs/html/exitcodes.html>
func run() int {
var b [8]byte

// seed random number generator
if _, err := crypto.Read(b[:]); err == nil {
rand.Seed(int64(binary.LittleEndian.Uint64(b[:]))) // https://stackoverflow.com/a/54491783/2252921
} else {
rand.Seed(time.Now().UnixNano()) // fallback
}

if err := (cli.NewApp(filepath.Base(os.Args[0]))).Run(os.Args); err != nil {
_, _ = color.New(color.FgHiRed, color.Bold).Fprintln(os.Stderr, err.Error())

Expand Down
12 changes: 8 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version: '3.8'

volumes:
tmp-data: {}
golint-go: {}
golint-cache: {}

services:
Expand All @@ -18,27 +19,29 @@ services:
- /etc/group:/etc/group:ro
- .:/src:rw
- tmp-data:/tmp:rw
security_opt: [no-new-privileges:true]

web:
<<: *app-service
ports:
- "8080:8080/tcp" # Open <http://127.0.0.1:8080>
command: sh -c "go build -buildvcs=false -o /tmp/app ./cmd/error-pages && /tmp/app serve"
command: sh -c "go build -buildvcs=false -o /tmp/app ./cmd/error-pages && /tmp/app serve --show-details --proxy-headers=X-Foo,Bar,Baz_blah"
healthcheck:
test: ['CMD', '/tmp/app', '--log-json', 'healthcheck']
interval: 4s
timeout: 1s
start_period: 5s
retries: 5

golint:
image: golangci/golangci-lint:v1.51-alpine # Image page: <https://hub.docker.com/r/golangci/golangci-lint>
environment:
GOLANGCI_LINT_CACHE: /tmp/golint # <https://github.com/golangci/golangci-lint/blob/v1.42.0/internal/cache/default.go#L68>
volumes:
- .:/src:ro
- golint-go:/go:rw # go dependencies will be downloaded on each run without this
- golint-cache:/tmp/golint:rw
- .:/src:ro
working_dir: /src
command: /bin/true
security_opt: [no-new-privileges:true]

hurl:
image: orangeopensource/hurl:1.8.0
Expand All @@ -47,3 +50,4 @@ services:
working_dir: /src
depends_on:
web: {condition: service_healthy}
security_opt: [no-new-privileges:true]

0 comments on commit b84b3ba

Please sign in to comment.