Commit 8eccee7 1 parent 53bb99b commit 8eccee7 Copy full SHA for 8eccee7
File tree 3 files changed +63
-6
lines changed
3 files changed +63
-6
lines changed Original file line number Diff line number Diff line change
1
+ # syntax=docker/dockerfile:1
2
+
3
+ # Build the application from source
4
+ FROM golang:1.23-alpine3.21 AS build-stage
5
+
6
+ WORKDIR /application
7
+
8
+ COPY go.mod go.sum ./
9
+ RUN go mod download
10
+
11
+ COPY . ./
12
+
13
+ RUN CGO_ENABLED=0 GOOS=linux go build -o /pulsar-products-service
14
+
15
+ # Run the tests in the container
16
+ FROM build-stage AS run-test-stage
17
+ RUN go test -v ./...
18
+
19
+ # Deploy the application binary into a lean image
20
+ FROM gcr.io/distroless/base-debian11 AS build-release-stage
21
+
22
+ WORKDIR /
23
+
24
+ COPY --from=build-stage /pulsar-products-service /pulsar-products-service
25
+
26
+ EXPOSE 8080
27
+
28
+ USER nonroot:nonroot
29
+
30
+ ENTRYPOINT ["/pulsar-products-service" ]
Original file line number Diff line number Diff line change
1
+ services :
2
+ pulsar-products-service :
3
+ # image: yaninyzwitty/pulsar-products-service:latest
4
+ build :
5
+ context : .
6
+ dockerfile : Dockerfile
7
+ ports :
8
+ - " 3000:3000"
9
+ env_file :
10
+ - .env
11
+ configs :
12
+ - source : my_config
13
+ target : ./my_config.yaml
14
+ networks :
15
+ - private_network
16
+
17
+
18
+
19
+ configs :
20
+ my_config :
21
+ file : config.yaml
22
+ networks :
23
+ private_network :
24
+ driver : bridge
25
+ ipam :
26
+ config :
27
+ - subnet : " 10.0.0.0/19"
28
+ gateway : " 10.0.0.1"
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ import (
10
10
"syscall"
11
11
"time"
12
12
13
- "github.com/joho/godotenv"
14
13
"github.com/yaninyzwitty/pulsar-outbox-products-service/controller"
15
14
"github.com/yaninyzwitty/pulsar-outbox-products-service/database"
16
15
"github.com/yaninyzwitty/pulsar-outbox-products-service/helpers"
28
27
29
28
func main () {
30
29
// Load configuration
31
- file , err := os .Open ("config .yaml" )
30
+ file , err := os .Open ("my_config .yaml" )
32
31
if err != nil {
33
32
slog .Error ("failed to open config.yaml" , "error" , err )
34
33
os .Exit (1 )
@@ -40,10 +39,10 @@ func main() {
40
39
os .Exit (1 )
41
40
}
42
41
43
- if err := godotenv .Load (); err != nil {
44
- slog .Error ("failed to load .env" , "error" , err )
45
- os .Exit (1 )
46
- }
42
+ // if err := godotenv.Load(); err != nil {
43
+ // slog.Error("failed to load .env", "error", err)
44
+ // os.Exit(1)
45
+ // }
47
46
password = os .Getenv ("DB_PASSWORD" )
48
47
token = os .Getenv ("PULSAR_TOKEN" )
49
48
You can’t perform that action at this time.
0 commit comments