chore: #174 make into template
All checks were successful
Build Docker Image / Build-Docker-Image (push) Successful in 47s

This commit is contained in:
2024-12-31 12:21:47 +01:00
parent 508aa3038b
commit 52f6d3d706
30 changed files with 89 additions and 89 deletions

View File

@@ -11,5 +11,5 @@ jobs:
steps: steps:
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- run: docker build . -t me-fit-test - run: docker build . -t web-app-template-test
- run: docker rmi me-fit-test - run: docker rmi web-app-template-test

View File

@@ -11,8 +11,8 @@ jobs:
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- run: docker login git.wundenbergs.de -u tim -p ${{ secrets.DOCKER_GITEA_TOKEN }} - run: docker login git.wundenbergs.de -u tim -p ${{ secrets.DOCKER_GITEA_TOKEN }}
- run: docker build . -t git.wundenbergs.de/x/me-fit:latest -t git.wundenbergs.de/x/me-fit:$GITHUB_SHA - run: docker build . -t git.wundenbergs.de/x/web-app-template:latest -t git.wundenbergs.de/x/web-app-template:$GITHUB_SHA
- run: docker push git.wundenbergs.de/x/me-fit:latest - run: docker push git.wundenbergs.de/x/web-app-template:latest
- run: docker push git.wundenbergs.de/x/me-fit:$GITHUB_SHA - run: docker push git.wundenbergs.de/x/web-app-template:$GITHUB_SHA
- run: docker rmi git.wundenbergs.de/x/me-fit:latest git.wundenbergs.de/x/me-fit:$GITHUB_SHA - run: docker rmi git.wundenbergs.de/x/web-app-template:latest git.wundenbergs.de/x/web-app-template:$GITHUB_SHA

View File

@@ -3,11 +3,11 @@ dir: mocks/
outpkg: mocks outpkg: mocks
issue-845-fix: True issue-845-fix: True
packages: packages:
me-fit/service: web-app-template/service:
interfaces: interfaces:
Random: Random:
Clock: Clock:
Mail: Mail:
me-fit/db: web-app-template/db:
interfaces: interfaces:
Auth: Auth:

View File

@@ -1,5 +1,5 @@
FROM golang:1.23.4@sha256:7ea4c9dcb2b97ff8ee80a67db3d44f98c8ffa0d191399197007d8459c1453041 AS builder_go FROM golang:1.23.4@sha256:7ea4c9dcb2b97ff8ee80a67db3d44f98c8ffa0d191399197007d8459c1453041 AS builder_go
WORKDIR /me-fit WORKDIR /web-app-template
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.62.2 RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.62.2
RUN go install github.com/a-h/templ/cmd/templ@latest RUN go install github.com/a-h/templ/cmd/templ@latest
RUN go install github.com/vektra/mockery/v2@latest RUN go install github.com/vektra/mockery/v2@latest
@@ -10,11 +10,11 @@ RUN templ generate
RUN mockery --log-level warn RUN mockery --log-level warn
RUN go test ./... RUN go test ./...
RUN golangci-lint run ./... RUN golangci-lint run ./...
RUN go build -o /me-fit/me-fit . RUN go build -o /web-app-template/web-app-template .
FROM node:22.12.0@sha256:0e910f435308c36ea60b4cfd7b80208044d77a074d16b768a81901ce938a62dc AS builder_node FROM node:22.12.0@sha256:0e910f435308c36ea60b4cfd7b80208044d77a074d16b768a81901ce938a62dc AS builder_node
WORKDIR /me-fit WORKDIR /web-app-template
COPY package.json package-lock.json ./ COPY package.json package-lock.json ./
RUN npm clean-install RUN npm clean-install
COPY . ./ COPY . ./
@@ -22,11 +22,11 @@ RUN npm run build
FROM debian:12.8@sha256:b877a1a3fdf02469440f1768cf69c9771338a875b7add5e80c45b756c92ac20a FROM debian:12.8@sha256:b877a1a3fdf02469440f1768cf69c9771338a875b7add5e80c45b756c92ac20a
WORKDIR /me-fit WORKDIR /web-app-template
RUN apt-get update && apt-get install -y ca-certificates && echo "" > .env RUN apt-get update && apt-get install -y ca-certificates && echo "" > .env
COPY migration ./migration COPY migration ./migration
COPY --from=builder_go /me-fit/me-fit ./me-fit COPY --from=builder_go /web-app-template/web-app-template ./web-app-template
COPY --from=builder_node /me-fit/static ./static COPY --from=builder_node /web-app-template/static ./static
EXPOSE 8080 EXPOSE 8080
ENTRYPOINT ["/me-fit/me-fit"] ENTRYPOINT ["/web-app-template/web-app-template"]

View File

@@ -1,8 +1,8 @@
package db package db
import ( import (
"me-fit/log" "web-app-template/log"
"me-fit/types" "web-app-template/types"
"database/sql" "database/sql"
"errors" "errors"

View File

@@ -2,7 +2,7 @@ package db
import ( import (
"database/sql" "database/sql"
"me-fit/types" "web-app-template/types"
"testing" "testing"
"time" "time"

View File

@@ -1,8 +1,8 @@
package db package db
import ( import (
"me-fit/log" "web-app-template/log"
"me-fit/types" "web-app-template/types"
"database/sql" "database/sql"
"errors" "errors"

View File

@@ -1,8 +1,8 @@
package db package db
import ( import (
"me-fit/log" "web-app-template/log"
"me-fit/types" "web-app-template/types"
"database/sql" "database/sql"
"errors" "errors"

2
go.mod
View File

@@ -1,4 +1,4 @@
module me-fit module web-app-template
go 1.22.5 go 1.22.5

View File

@@ -1,12 +1,12 @@
package handler package handler
import ( import (
"me-fit/handler/middleware" "web-app-template/handler/middleware"
"me-fit/log" "web-app-template/log"
"me-fit/service" "web-app-template/service"
"me-fit/template/auth" "web-app-template/template/auth"
"me-fit/types" "web-app-template/types"
"me-fit/utils" "web-app-template/utils"
"errors" "errors"
"net/http" "net/http"

View File

@@ -1,9 +1,9 @@
package handler package handler
import ( import (
"me-fit/handler/middleware" "web-app-template/handler/middleware"
"me-fit/service" "web-app-template/service"
"me-fit/template" "web-app-template/template"
"net/http" "net/http"

View File

@@ -4,8 +4,8 @@ import (
"context" "context"
"net/http" "net/http"
"me-fit/service" "web-app-template/service"
"me-fit/types" "web-app-template/types"
) )
type ContextKey string type ContextKey string

View File

@@ -5,10 +5,10 @@ import (
"net/http" "net/http"
"strings" "strings"
"me-fit/log" "web-app-template/log"
"me-fit/service" "web-app-template/service"
"me-fit/types" "web-app-template/types"
"me-fit/utils" "web-app-template/utils"
) )
type csrfResponseWriter struct { type csrfResponseWriter struct {

View File

@@ -5,7 +5,7 @@ import (
"strconv" "strconv"
"time" "time"
"me-fit/log" "web-app-template/log"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/client_golang/prometheus/promauto"

View File

@@ -3,7 +3,7 @@ package middleware
import ( import (
"net/http" "net/http"
"me-fit/types" "web-app-template/types"
) )
func SecurityHeaders(serverSettings *types.Settings) func(http.Handler) http.Handler { func SecurityHeaders(serverSettings *types.Settings) func(http.Handler) http.Handler {

View File

@@ -1,10 +1,10 @@
package handler package handler
import ( import (
"me-fit/log" "web-app-template/log"
"me-fit/template" "web-app-template/template"
"me-fit/template/auth" "web-app-template/template/auth"
"me-fit/types" "web-app-template/types"
"net/http" "net/http"

View File

@@ -1,10 +1,10 @@
package handler package handler
import ( import (
"me-fit/handler/middleware" "web-app-template/handler/middleware"
"me-fit/service" "web-app-template/service"
"me-fit/template/workout" "web-app-template/template/workout"
"me-fit/utils" "web-app-template/utils"
"net/http" "net/http"
"strconv" "strconv"

12
main.go
View File

@@ -1,12 +1,12 @@
package main package main
import ( import (
"me-fit/db" "web-app-template/db"
"me-fit/handler" "web-app-template/handler"
"me-fit/handler/middleware" "web-app-template/handler/middleware"
"me-fit/log" "web-app-template/log"
"me-fit/service" "web-app-template/service"
"me-fit/types" "web-app-template/types"
"context" "context"
"database/sql" "database/sql"

View File

@@ -11,8 +11,8 @@ import (
"testing" "testing"
"time" "time"
"me-fit/service" "web-app-template/service"
"me-fit/types" "web-app-template/types"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"

4
package-lock.json generated
View File

@@ -1,11 +1,11 @@
{ {
"name": "me-fit", "name": "web-app-template",
"version": "1.0.0", "version": "1.0.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "me-fit", "name": "web-app-template",
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {

View File

@@ -1,5 +1,5 @@
{ {
"name": "me-fit", "name": "web-app-template",
"version": "1.0.0", "version": "1.0.0",
"description": "Your (almost) independent tech stack to host on a VPC.", "description": "Your (almost) independent tech stack to host on a VPC.",
"main": "index.js", "main": "index.js",

View File

@@ -8,10 +8,10 @@ import (
"strings" "strings"
"time" "time"
"me-fit/db" "web-app-template/db"
"me-fit/log" "web-app-template/log"
mailTemplate "me-fit/template/mail" mailTemplate "web-app-template/template/mail"
"me-fit/types" "web-app-template/types"
"github.com/google/uuid" "github.com/google/uuid"
"golang.org/x/crypto/argon2" "golang.org/x/crypto/argon2"
@@ -249,7 +249,7 @@ func (service AuthImpl) SendVerificationMail(userId uuid.UUID, email string) {
return return
} }
service.mail.SendMail(email, "Welcome to ME-FIT", w.String()) service.mail.SendMail(email, "Welcome to web-app-template", w.String())
} }
func (service AuthImpl) VerifyUserEmail(tokenStr string) error { func (service AuthImpl) VerifyUserEmail(tokenStr string) error {

View File

@@ -1,9 +1,9 @@
package service package service
import ( import (
"me-fit/db" "web-app-template/db"
"me-fit/mocks" "web-app-template/mocks"
"me-fit/types" "web-app-template/types"
"strings" "strings"
"testing" "testing"
@@ -127,7 +127,7 @@ func TestSendVerificationMail(t *testing.T) {
mockAuthDb.EXPECT().GetTokensByUserIdAndType(userId, types.TokenTypeEmailVerify).Return(tokens, nil) mockAuthDb.EXPECT().GetTokensByUserIdAndType(userId, types.TokenTypeEmailVerify).Return(tokens, nil)
mockMail.EXPECT().SendMail(email, "Welcome to ME-FIT", mock.MatchedBy(func(message string) bool { mockMail.EXPECT().SendMail(email, "Welcome to web-app-template", mock.MatchedBy(func(message string) bool {
return strings.Contains(message, token.Token) return strings.Contains(message, token.Token)
})).Return() })).Return()

View File

@@ -1,8 +1,8 @@
package service package service
import ( import (
"me-fit/log" "web-app-template/log"
"me-fit/types" "web-app-template/types"
"fmt" "fmt"
"net/smtp" "net/smtp"

View File

@@ -1,8 +1,8 @@
package service package service
import ( import (
"me-fit/log" "web-app-template/log"
"me-fit/types" "web-app-template/types"
"crypto/rand" "crypto/rand"
"encoding/base64" "encoding/base64"

View File

@@ -1,8 +1,8 @@
package service package service
import ( import (
"me-fit/db" "web-app-template/db"
"me-fit/types" "web-app-template/types"
"errors" "errors"
"strconv" "strconv"

View File

@@ -1,16 +1,16 @@
package template package template
templ Index() { templ Index() {
<div class="hero bg-base-200 h-full"> <div class="hero bg-base-200 h-full">
<div class="hero-content text-center"> <div class="hero-content text-center">
<div class="max-w-md"> <div class="max-w-md">
<h1 class="text-5xl font-bold">Next Level Workout Tracker</h1> <h1 class="text-5xl font-bold">Next Level Workout Tracker</h1>
<p class="py-6"> <p class="py-6">
Ever wanted to track your workouts and see your progress over time? ME-FIT is the perfect Ever wanted to track your workouts and see your progress over time? web-app-template is the perfect
solution for you. solution for you.
</p> </p>
<a href="/workout" class="btn btn-primary">Get Started</a> <a href="/workout" class="btn btn-primary">Get Started</a>
</div>
</div> </div>
</div> </div>
</div>
} }

View File

@@ -6,7 +6,7 @@ templ Layout(slot templ.Component, user templ.Component) {
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>ME-FIT</title> <title>web-app-template</title>
<link rel="icon" href="/static/favicon.svg" /> <link rel="icon" href="/static/favicon.svg" />
<link rel="stylesheet" href="/static/css/tailwind.css" /> <link rel="stylesheet" href="/static/css/tailwind.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
@@ -23,8 +23,8 @@ templ Layout(slot templ.Component, user templ.Component) {
<div class="h-screen flex flex-col"> <div class="h-screen flex flex-col">
<div class="flex justify-end items-center gap-2 py-1 px-2 h-12 md:gap-10 md:px-10 md:py-2 shadow"> <div class="flex justify-end items-center gap-2 py-1 px-2 h-12 md:gap-10 md:px-10 md:py-2 shadow">
<a href="/" class="flex-1 flex gap-2"> <a href="/" class="flex-1 flex gap-2">
<img src="/static/favicon.svg" alt="ME-FIT logo" /> <img src="/static/favicon.svg" alt="web-app-template logo" />
<span>ME-FIT</span> <span>web-app-template</span>
</a> </a>
@user @user
</div> </div>

View File

@@ -1,7 +1,7 @@
package types package types
import ( import (
"me-fit/log" "web-app-template/log"
) )
type Settings struct { type Settings struct {

View File

@@ -5,7 +5,7 @@ import (
"net/http" "net/http"
"time" "time"
"me-fit/log" "web-app-template/log"
) )
func TriggerToast(w http.ResponseWriter, r *http.Request, class string, message string, statusCode int) { func TriggerToast(w http.ResponseWriter, r *http.Request, class string, message string, statusCode int) {