Skip to content

Commit

Permalink
Merge pull request #1 from t-muehlberger/feature/stats
Browse files Browse the repository at this point in the history
Metrics
  • Loading branch information
t-muehlberger committed Sep 13, 2024
2 parents 7ea9c84 + 16cf599 commit 36e7efa
Show file tree
Hide file tree
Showing 18 changed files with 9,768 additions and 23,596 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build and Push Images

on:
push:
branches:
- main
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21.x'
- name: Install dependencies
run: go mod download
- name: Test with Go
run: go test ./...

build_and_push:
runs-on: ubuntu-latest
needs:
- test
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@main

- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}

- name: 'Setup docker buildx'
uses: docker/setup-buildx-action@v3

- name: 'Build and Push Image'
run: |
docker buildx create --use --name=crossplat --node=crossplat
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t ghcr.io/t-muehlberger/sharepass:latest \
--push \
.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ sharepass

pkg/assets/web-ui

__debug_bin
__debug_bin*

/data

vendor

*.pem
*.pem

.env
3 changes: 2 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/main.go"
"program": "${workspaceFolder}/main.go",
"envFile": "${workspaceFolder}/.env"
}
]
}
3 changes: 1 addition & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Enter Secret | Show Secret

**Prerequisites:**

- Go 1.16+
- Go 1.23+
- Node.js 14+
- NPM

Expand All @@ -43,7 +43,6 @@ Enter Secret | Show Secret
npm run build

cd ..
go get github.com/deepmap/oapi-codegen/cmd/[email protected]
go generate
go build

Expand Down
11 changes: 7 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
version: "3.7"
services:
sharepass:
image: tmuehlberger/sharepass:latest
image: ghcr.io/t-muehlberger/sharepass:latest
build: .
ports:
- "5000:5000"
volumes:
- .:/code
- data:/app/data
environment:
PG_HOST: postgres
PG_HOST: postgres:5432
PG_DB: postgres
PG_USER: postgres
PG_PWD: postgres
depends_on:
- postgres
restart: unless-stopped
postgres:
image: postgres:13.3
image: postgres:16
ports:
- "127.0.0.1:55432:5432"
environment:
POSTGRES_PASSWORD: postgres
restart: unless-stopped
volumes:
data: {}
24 changes: 13 additions & 11 deletions dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,33 @@ RUN npm run build

#####

FROM golang:1.16-alpine as go-builder
FROM golang:1.23-alpine as go-builder

WORKDIR /app

ENV CGO_ENABLED 0
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH

COPY go.* ./
WORKDIR /app

COPY go.mod go.sum ./
RUN go mod download

COPY . .

COPY --from=js-builder /app/web-ui/dist pkg/assets/web-ui

RUN go get github.com/deepmap/oapi-codegen/cmd/[email protected]

RUN go generate

RUN go build -o sharepass *.go
RUN --mount=type=cache,target=/root/.cache/go-build \
go generate && \
CGO_ENABLED=0 \
GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
go build -o sharepass -ldflags "-w -s" *.go

#####

FROM alpine:3.13
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:latest

RUN apk --update add ca-certificates && \
update-ca-certificates && \
rm -rf /var/cache/apk/*

WORKDIR /app
Expand Down
77 changes: 67 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,72 @@
module github.com/t-muehlberger/sharepass

go 1.16
go 1.23

require (
github.com/deepmap/oapi-codegen v1.6.1
github.com/dgraph-io/badger/v3 v3.2011.1
github.com/getkin/kin-openapi v0.55.0
github.com/go-openapi/swag v0.19.14 // indirect
github.com/go-pg/pg/v10 v10.9.3
github.com/google/uuid v1.2.0
github.com/labstack/echo/v4 v4.2.2
github.com/onsi/gomega v1.12.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
github.com/dgraph-io/badger/v3 v3.2103.5
github.com/getkin/kin-openapi v0.125.0
github.com/go-pg/pg/v10 v10.13.0
github.com/google/uuid v1.6.0
github.com/labstack/echo/v4 v4.12.0
github.com/oapi-codegen/oapi-codegen/v2 v2.3.0
github.com/oapi-codegen/runtime v1.1.1
github.com/prometheus/client_golang v1.20.3
)

require (
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-pg/zerochecker v0.2.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang/glog v1.2.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/flatbuffers v24.3.25+incompatible // indirect
github.com/invopop/yaml v0.3.1 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nxadm/tail v1.4.11 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/gomega v1.27.10 // indirect
github.com/perimeterx/marshmallow v1.1.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/vmihailenco/bufpool v0.1.11 // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser v0.1.2 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/time v0.6.0 // indirect
golang.org/x/tools v0.25.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
mellium.im/sasl v0.3.1 // indirect
)
Loading

0 comments on commit 36e7efa

Please sign in to comment.