Created
March 31, 2024 22:03
-
-
Save andreleoni/53f8dee97c9b8a2d404d0886c7995dbe to your computer and use it in GitHub Desktop.
Golang docker-compose.yml with mongodb and multiple microservices
This file contains hidden or 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
version: "3" | |
services: | |
errortracker: | |
depends_on: | |
- mongodb | |
- mongo-express | |
build: | |
context: . | |
dockerfile: Dockerfile | |
command: go run errortracker/main.go | |
volumes: | |
- .:/go/src/app | |
application: | |
depends_on: | |
- mongodb | |
- mongo-express | |
- errortracker | |
build: | |
context: . | |
dockerfile: Dockerfile | |
command: go run application/main.go | |
volumes: | |
- .:/go/src/app | |
mongodb: | |
image: mongo | |
volumes: | |
- mongodb_data:/data/db | |
mongo-express: | |
image: mongo-express | |
ports: | |
- "8081:8081" | |
environment: | |
- ME_CONFIG_MONGODB_SERVER=mongodb | |
- ME_CONFIG_MONGODB_PORT=27017 | |
- ME_CONFIG_BASICAUTH_USERNAME=admin | |
- ME_CONFIG_BASICAUTH_PASSWORD=admin | |
volumes: | |
mongodb_data: |
This file contains hidden or 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
FROM golang:1.22.1 | |
WORKDIR /go/src/app | |
COPY . . | |
RUN go mod download |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment