-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored repo layout to Go standard and added basics of a Dockerise…
…d environment
- Loading branch information
Showing
12 changed files
with
110 additions
and
19 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,2 +1,10 @@ | ||
# JetBrains directories | ||
.idea | ||
# IDE directories and files | ||
.idea | ||
.vscode | ||
.vs | ||
|
||
# OS directories and files | ||
**/.DS_Store | ||
|
||
# Build artifacts | ||
**/dist |
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,24 @@ | ||
FROM golang:1.22.5 | ||
|
||
# Set destination for COPY | ||
WORKDIR /app | ||
|
||
# Download Go modules | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
# Copy the entire project or the necessary directories, preserving the structure | ||
COPY . . | ||
|
||
# Build the Go application | ||
RUN go build -o /dist cmd/accounts/main.go | ||
|
||
# Expose the application port | ||
EXPOSE 8080 | ||
|
||
# Options to run in debug or release mode | ||
ARG CONFIG=debug | ||
ENV GIN_MODE=${CONFIG} | ||
|
||
# Run the compiled application | ||
CMD ["/dist"] |
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,4 +1,4 @@ | ||
package accounts | ||
package app | ||
|
||
type account struct { | ||
AccountID string `json:"accountId"` | ||
|
2 changes: 1 addition & 1 deletion
2
src/accounts/account_types.go → cmd/accounts/app/account_types.go
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,4 +1,4 @@ | ||
package accounts | ||
package app | ||
|
||
type AccountType int | ||
|
||
|
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
File renamed without changes.
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,67 @@ | ||
services: | ||
################################### | ||
# dapr placement service # | ||
################################### | ||
placement: | ||
image: daprio/placement:latest | ||
container_name: placement | ||
command: [ "./placement", "--port", "50006" ] | ||
ports: | ||
- 50006:50006 | ||
networks: | ||
- bank-network | ||
|
||
################################### | ||
# redis # | ||
################################### | ||
redis: | ||
image: redis:6 | ||
container_name: redis | ||
ports: | ||
- 6379:6379 | ||
networks: | ||
- bank-network | ||
|
||
################################### | ||
# rabbitmq # | ||
################################### | ||
rabbitmq: | ||
image: rabbitmq:3-management | ||
container_name: rabbitmq | ||
ports: | ||
- 5672:5672 | ||
- 15672:15672 | ||
networks: | ||
- bank-network | ||
|
||
################################### | ||
# accounts service + dapr sidecar # | ||
################################### | ||
accounts-service: | ||
image: bank-with-dapr/accounts:dev | ||
container_name: accounts-service | ||
build: | ||
context: . | ||
dockerfile: cmd/accounts/Dockerfile | ||
tags: | ||
- bank-with-dapr/accounts:dev | ||
ports: | ||
- 8080:8080 | ||
networks: | ||
- bank-network | ||
|
||
accounts-service-dapr: | ||
image: daprio/daprd:latest | ||
command: [ "./daprd", | ||
"--app-id", "accounts-service", | ||
"--app-port", "8080", | ||
"--placement-host-address", "placement:50006", | ||
"--components-path", "/components" ] | ||
volumes: | ||
- ./dapr/:/components | ||
depends_on: | ||
- placement | ||
network_mode: "service:accounts-service" | ||
|
||
networks: | ||
bank-network: null |
File renamed without changes.
File renamed without changes.
Empty file.