Hello
I’m trying to configure a fresh dev environnement to work on my local machine. I tried to follow the official documentation and build a compose-dev.yaml file.
My root folder is as follow :
dev
frontend
DockerFile
compose-dev.yaml
My compose-dev.yaml file :
version: "3.7"
services:
backend:
build:
context: backend
target: development
secrets:
- db-password
depends_on:
- db
db:
image: mariadb
restart: always
healthcheck:
test: [ "CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent" ]
interval: 3s
retries: 5
start_period: 30s
secrets:
- db-password
volumes:
- db-data:/var/lib/mysql
environment:
- MYSQL_DATABASE=example
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db-password
expose:
- 3306
proxy:
build: proxy
ports:
- 8080:80
depends_on:
- backend
volumes:
db-data:
secrets:
db-password:
file: db/password.txt
My Dockerfile :
FROM golang:1.16-alpine AS build
WORKDIR /go/src/github.com/org/repo
COPY . .
RUN go build -o server .
FROM build AS development
RUN apk update \
&& apk add git
CMD ["go", "run", "main.go"]
FROM alpine:3.12
EXPOSE 8000
COPY --from=build /go/src/github.com/org/repo/server /server
CMD ["/server"]
When I chose compose based dev environnement in docker desktop and select my local folder. It start to with : pulling image…
Then it says almost immediately starting container and it finishes very quickly.
When I open in vscode nothing is installed go no command found
Am I doing something wrong ?
Thank you for your help !