-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from wednesday-solutions/feat/updating-env-seeder
Feat/updating env seeder
- Loading branch information
Showing
24 changed files
with
327 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
ENV_INJECTION=false | ||
SERVER_DEBUG=true | ||
SERVER_READ_TIMEOUT=10 | ||
SERVER_WRITE_TIMEOUT=5 | ||
JWT_MIN_SECRET_LENGTH=64 | ||
JWT_DURATION_MINUTES=1440 | ||
JWT_REFRESH_DURATION=3499200 | ||
JWT_MAX_REFRESH=1440 | ||
JWT_SIGNING_ALGORITHM=HS256 | ||
DB_LOG_QUERIES=true | ||
DB_TIMEOUT_SECONDS=5 | ||
APP_MIN_PASSWORD_STR=1 | ||
SERVER_PORT=9000 | ||
COPILOT_DB_CREDS_VIA_SECRETS_MANAGER=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,48 @@ | ||
FROM golang:1.18-alpine3.16 | ||
FROM golang:1.18-alpine3.16 AS builder | ||
RUN apk add build-base | ||
|
||
RUN mkdir -p /go/src/github.com/wednesday-solutions/go-template-mysql | ||
|
||
ADD . /go/src/github.com/wednesday-solutions/go-template-mysql | ||
|
||
WORKDIR /go/src/github.com/wednesday-solutions/go-template-mysql | ||
RUN mkdir /app | ||
ADD . /app | ||
|
||
WORKDIR /app | ||
ARG ENVIRONMENT_NAME | ||
ENV ENVIRONMENT_NAME=$ENVIRONMENT_NAME | ||
RUN GOARCH=amd64 \ | ||
GOOS=linux \ | ||
CGO_ENABLED=0 \ | ||
go mod vendor | ||
RUN mkdir -p /go/src/github.com/wednesday-solutions/go-template-mysql/output | ||
RUN go build -o ./output/main ./cmd/server/main.go | ||
RUN go build -o ./output/seeder ./cmd/seeder/main.go | ||
|
||
|
||
RUN go run ./cmd/seeder/main.go | ||
RUN go build -o ./output/server ./cmd/server/main.go | ||
RUN go build -o ./output/migrations ./cmd/migrations/main.go | ||
RUN go build -o ./output/seeder ./cmd/seeder/exec/seed.go | ||
|
||
|
||
FROM golang:1.18-alpine3.16 | ||
ARG ENVIRONMENT_NAME | ||
RUN mkdir -p /app/ | ||
ADD . /app | ||
FROM alpine:latest | ||
RUN apk add --no-cache libc6-compat | ||
RUN apk add --no-cache --upgrade bash | ||
RUN addgroup -S nonroot \ | ||
&& adduser -S nonroot -G nonroot | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=0 /go/src/github.com/wednesday-solutions/go-template-mysql/output /app/ | ||
ARG ENVIRONMENT_NAME | ||
ENV ENVIRONMENT_NAME=$ENVIRONMENT_NAME | ||
|
||
CMD ["sh", "/app/scripts/migrate-and-run.sh"] | ||
EXPOSE 9000 | ||
RUN mkdir -p /app/ | ||
WORKDIR /app | ||
USER nonroot | ||
|
||
COPY /scripts /app/scripts/ | ||
COPY --from=builder /app/output/ /app/ | ||
COPY --from=builder /app/cmd/seeder/exec/build/ /app/cmd/seeder/exec/build/ | ||
|
||
COPY ./.env.* /app/output/ | ||
COPY ./.env.* /app/output/cmd/seeder/exec/build/ | ||
COPY ./.env.* /app/output/cmd/seeder/exec/ | ||
COPY ./.env.* /app/output/cmd/seeder/ | ||
COPY ./.env.* /app/output/cmd/ | ||
COPY ./.env.* /app/ | ||
COPY ./scripts/ /app/ | ||
COPY --from=builder /app/internal/migrations/ /app/internal/migrations/ | ||
CMD ["bash","./migrate-and-run.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
version: '2' | ||
|
||
tasks: | ||
hello: | ||
cmds: | ||
- echo "hello world" | ||
test: | ||
cmds: | ||
- echo " *** Running Coverage Tests ***" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package main | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
"log" | ||
"os" | ||
"os/exec" | ||
|
||
"golang.org/x/exp/slices" | ||
) | ||
|
||
func main() { | ||
|
||
base, _ := os.Getwd() | ||
log.Println(base) | ||
|
||
base += "/cmd/seeder/exec/build" | ||
fmt.Println(base) | ||
|
||
files, err := os.ReadDir(base) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
log.Println(len(files)) | ||
|
||
for _, file := range files { | ||
|
||
log.Println(file.Name()) | ||
if slices.Contains([]string{"seed.go", ".env.docker"}, file.Name()) { | ||
continue | ||
} | ||
cmd := exec. | ||
Command(fmt.Sprintf("%s/%s", base, file.Name())) | ||
var outb, errb bytes.Buffer | ||
cmd.Stdout = &outb | ||
cmd.Stderr = &errb | ||
err := cmd.Run() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
fmt.Println("out:", outb.String(), "err:", errb.String()) | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.