Skip to content

Commit

Permalink
chore(devcontainer): set devcontainer config to work with VSCode
Browse files Browse the repository at this point in the history
  • Loading branch information
vareversat committed Sep 30, 2023
1 parent c7db7d0 commit c439053
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 26 deletions.
24 changes: 24 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "Go",
"dockerComposeFile": "../compose.yml",
"service": "app",
"workspaceFolder": "/app",
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"k--kato.intellij-idea-keybindings",
"golang.go",
"ms-azuretools.vscode-docker",
"ms-vscode.makefile-tools"
]
}
},
"portsAttributes": {
"8080": {
"label": "API Port",
"onAutoForward": "notify"
}
},
"overrideCommand": false
}
12 changes: 0 additions & 12 deletions .dockerignore

This file was deleted.

10 changes: 8 additions & 2 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ FROM golang:1.20 as build
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
# Dependency used to build Swagger config
RUN go install github.com/swaggo/swag/cmd/swag@latest
# Dependencies used for static config
RUN go install golang.org/x/tools/gopls@latest
RUN go install github.com/go-delve/delve/cmd/dlv@latest
RUN go install honnef.co/go/tools/cmd/staticcheck@latest
RUN go install golang.org/x/tools/cmd/godoc@latest

COPY . .
# Refresh Swagger config
RUN swag init -d ./internal/api,./ -g router.go

EXPOSE 8080

CMD ["go", "run", "."]
17 changes: 5 additions & 12 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ services:
build:
context: .
dockerfile: Dockerfile.dev
command: sleep infinity
volumes:
- .:/app
ports:
- "8080:8080"
- "6060:6060"
env_file:
- .env.dev

Expand All @@ -17,15 +21,4 @@ services:
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: my_password
MONGO_INITDB_DATABASE: chabo-api

mongo-express:
container_name: mongo-express
image: mongo-express
restart: always
ports:
- 8081:8081
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: my_password
ME_CONFIG_MONGODB_URL: mongodb://root:my_password@mongo:27017/
MONGO_INITDB_DATABASE: chabo-api

0 comments on commit c439053

Please sign in to comment.