Skip to content

Commit 7e4d104

Browse files
committed
feat: configure build test and dev scripts
1 parent 6033c0e commit 7e4d104

File tree

9 files changed

+26
-23
lines changed

9 files changed

+26
-23
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ dist-ssr
2727
# Go Modules
2828

2929
tmp
30-
http/cmd/*
31-
!http/cmd/*.go
3230

3331
# Terraform
3432

docker/Dockerfile.backend

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
FROM golang:1.23 as builder
22

3-
WORKDIR /app
3+
WORKDIR /usr/src/app
44

55
COPY go.mod go.sum ./
66

77
RUN go mod download
88

99
COPY . .
1010

11-
RUN cd cmd/api-server && CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
11+
RUN CGO_ENABLED=0 GOOS=linux go build -C cmd -a -installsuffix cgo -o ../bin/main .
1212

1313
FROM alpine:latest
1414

15-
WORKDIR /root/
15+
WORKDIR /usr/src/app
1616

17-
RUN apk --no-cache add curl
18-
RUN curl -sfS https://dotenvx.sh/install.sh | sh
19-
20-
COPY --from=builder /app/.env* ./
21-
COPY --from=builder /app/cmd/api-server/main .
17+
COPY --from=builder /app/bin/main .
2218

2319
EXPOSE 3333
2420

http/.air.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tmp_dir = "tmp"
44
[build]
55
args_bin = []
66
bin = "./tmp/main"
7-
cmd = "cd cmd && go build -o main . && cp main ../tmp/"
7+
cmd = "go build -C cmd -o ../bin/main . && cp bin/main ../tmp/"
88
delay = 1000
99
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
1010
exclude_file = []

http/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
build-errors.log
2-
!bin/air
2+
bin

scripts/package/build.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ C_SEAGREEN2="\033[38;5;83m"
66
C_GREY46="\033[38;5;243m"
77
C_GREY62="\033[38;5;247m"
88

9+
clear
10+
911
echo "\n${F_BOLD}Build Packages${NO_FORMAT}"
1012

1113
cd frontend
@@ -16,19 +18,17 @@ echo "${C_GREY46}Build Service - frontend${NO_FORMAT}\n"
1618

1719
prettier --write --loglevel silent . && eslint . --fix
1820

19-
tsc -b && dotenvx run -f --quiet ../.env.production -- pnpm vite build .
21+
tsc -b && dotenvx run -f --quiet ../.env.production -- pnpm vite build . --log-level silent
2022

2123
echo "${F_BOLD}Done!${NO_FORMAT}"
2224

2325
echo "\n${C_GREY46}Build Service - http${NO_FORMAT}\n"
2426

2527
cd ../http
2628

27-
rm ./cmd/main
28-
2929
gofmt -w ./cmd/* ./internal/
3030

31-
cd cmd && CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
31+
CGO_ENABLED=0 GOOS=linux go build -C cmd -a -installsuffix cgo -o ../bin/main .
3232

3333
echo "${F_BOLD}Done!${NO_FORMAT}"
3434

scripts/package/bump.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ C_SEAGREEN2="\033[38;5;83m"
66
C_GREY46="\033[38;5;243m"
77
C_GREY62="\033[38;5;247m"
88

9+
clear
10+
911
echo "\n${F_BOLD}Update Package Version${NO_FORMAT}\n"
1012

1113
PROJECT=""

scripts/package/dev.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ echo "\n${F_BOLD}Run Development Container${NO_FORMAT}${C_GREY46}\n"
1212

1313
echo "${NO_FORMAT}${F_BOLD}Building packages${NO_FORMAT}${C_GREY46}\n"
1414

15-
cd frontend
15+
cd frontend
1616

17-
tsc -b && dotenvx run -f --quiet ../.env.local -- pnpm vite build .
17+
tsc -b && pnpm vite build . --log-level silent
1818

19-
cd ../http/cmd && go build -o main .
19+
cd ../
20+
21+
go build -C http/cmd -o ../bin/main .
2022

2123
echo "${NO_FORMAT}${F_BOLD}Done!${NO_FORMAT}${C_GREY46}\n"
2224

2325
echo "${NO_FORMAT}${F_BOLD}Building development images${NO_FORMAT}${C_GREY46}\n"
2426

25-
cd ../../
26-
2727
docker-compose -f docker/docker-compose.yml up --build
2828

2929
echo "\n${NO_FORMAT}${F_BOLD}Done!${NO_FORMAT}\n"

scripts/package/tail.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ C_SEAGREEN2="\033[38;5;83m"
66
C_GREY46="\033[38;5;243m"
77
C_GREY62="\033[38;5;247m"
88

9+
clear
10+
911
echo "\n${F_BOLD}Tail development container${NO_FORMAT}\n"
1012

1113
docker-compose -f docker/docker-compose.yml logs -f --timestamps --no-log-prefix

scripts/package/test.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,21 @@ C_SEAGREEN2="\033[38;5;83m"
66
C_GREY46="\033[38;5;243m"
77
C_GREY62="\033[38;5;247m"
88

9+
910
echo "\n${F_BOLD}Test Packages${NO_FORMAT}\n"
1011

1112
echo "${C_GREY46}Test - frontend${NO_FORMAT}\n"
13+
1214
cd frontend
15+
1316
tsc
17+
1418
echo "${F_BOLD}Done!${NO_FORMAT}\n"
1519

1620
echo "${C_GREY46}Test - http${NO_FORMAT}\n"
17-
cd ../http/cmd
18-
go build
21+
22+
echo "No tests found!"
23+
1924
echo "${F_BOLD}Done!${NO_FORMAT}\n"
2025

2126
# dotenvx run ../../.env.test --quiet -- vitest run

0 commit comments

Comments
 (0)