check that gomod dir available before binding
All checks were successful
Deploy / CreateImage (push) Successful in 2m11s
Deploy / DeployService (push) Successful in 24s

This commit is contained in:
skeris 2024-12-30 01:46:06 +03:00
parent 4b3ee58dd2
commit 65469aa3a6
5 changed files with 10 additions and 17 deletions

1
.gitignore vendored

@ -1,3 +1,4 @@
.idea .idea
main main
.vscode .vscode
DockerTest

@ -2,17 +2,13 @@ FROM gitea.pena/penadevops/container-images/golang:main as build
WORKDIR /app WORKDIR /app
ENV GOPRIVATE=gitea.pena/PenaSide/common,gitea.pena/PenaSide/linters-golang,gitea.pena/PenaSide/customer,gitea.pena/PenaSide/trashlog,gitea.pena/PenaSide/hlog ENV GOPRIVATE=gitea.pena/PenaSide/common,gitea.pena/PenaSide/linters-golang,gitea.pena/PenaSide/customer,gitea.pena/PenaSide/trashlog,gitea.pena/PenaSide/hlog
ENV GOINSECURE=gitea.pena/PenaSide/common,gitea.pena/PenaSide/linters-golang,gitea.pena/PenaSide/customer,gitea.pena/PenaSide/trashlog,gitea.pena/PenaSide/hlog ENV GOINSECURE=gitea.pena/PenaSide/common,gitea.pena/PenaSide/linters-golang,gitea.pena/PenaSide/customer,gitea.pena/PenaSide/trashlog,gitea.pena/PenaSide/hlog
ENV GOPROXY=https://proxy.golang.org,direct
COPY . . COPY . .
RUN --mount=type=bind,source=go-cache,dst=/go/pkg/mod/,rw=true go mod download RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o app ./cmd/verification/main.go RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o app ./cmd/verification/main.go
RUN ls /go/pkg/mod/
RUN pwd
RUN printenv RUN printenv
FROM gitea.pena/penadevops/container-images/alpine:main FROM gitea.pena/penadevops/container-images/alpine:main
COPY --from=build app/app . COPY --from=build app/app .
COPY --from=build app/staging.env .
COPY --from=build app/assets ./assets COPY --from=build app/assets ./assets
RUN apk add --no-cache ca-certificates RUN apk add --no-cache ca-certificates
CMD ["/app"] CMD ["/app"]

@ -28,11 +28,11 @@ services:
MONGO_URL: mongodb://verification:54143ffdd9304865586e5cf1@10.7.0.6:27017/?authSource=verification MONGO_URL: mongodb://verification:54143ffdd9304865586e5cf1@10.7.0.6:27017/?authSource=verification
MONGO_DB_NAME: verification MONGO_DB_NAME: verification
JWT_SECRET: > JWT_SECRET: >
-----BEGIN PUBLIC KEY----- -----BEGIN PUBLIC KEY-----\n
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCLW1tlHyKC9AG0hGpmkksET2DE MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCLW1tlHyKC9AG0hGpmkksET2DE\n
r7ojSPemxFWAgFgcPJWQ7x3uNbsdJ3bIZFoA/FClaWKMCZmjnH9tv0bKZtY/CDhM r7ojSPemxFWAgFgcPJWQ7x3uNbsdJ3bIZFoA/FClaWKMCZmjnH9tv0bKZtY/CDhM\n
ZEyHpMruRSn6IKrxjtQZWy4uv/w6MzUeyBYG0OvNCiYpdvz5SkAGAUHD5ZNFqn2w ZEyHpMruRSn6IKrxjtQZWy4uv/w6MzUeyBYG0OvNCiYpdvz5SkAGAUHD5ZNFqn2w\n
KKFD0I2Dr59BFVSGJwIDAQAB KKFD0I2Dr59BFVSGJwIDAQAB\n
-----END PUBLIC KEY----- -----END PUBLIC KEY-----\n
tty: true tty: true

@ -19,6 +19,7 @@ import (
"go.uber.org/zap" "go.uber.org/zap"
"go.uber.org/zap/zapcore" "go.uber.org/zap/zapcore"
"time" "time"
"os"
) )
type Build struct { type Build struct {
@ -37,7 +38,7 @@ func Run(cfg *config.Config, build Build) {
panic(err) panic(err)
} }
logger.Info("RUN", zap.Any("ENV", cfg)) logger.Info("RUN", zap.Any("ENV", cfg), zap.String("JWT_SECRET", os.Getenv("JWT_SECRET")))
ctx := context.Background() ctx := context.Background()

@ -3,7 +3,6 @@ package config
import ( import (
"gitea.pena/PenaSide/common/mongo" "gitea.pena/PenaSide/common/mongo"
"github.com/caarlos0/env/v8" "github.com/caarlos0/env/v8"
"github.com/joho/godotenv"
) )
type Config struct { type Config struct {
@ -28,10 +27,6 @@ type External struct {
} }
func NewConfig(file ...string) (*Config, error) { func NewConfig(file ...string) (*Config, error) {
if err := godotenv.Load(file...); err != nil {
return nil, err
}
var cfg Config var cfg Config
if err := env.Parse(&cfg); err != nil { if err := env.Parse(&cfg); err != nil {
return nil, err return nil, err