Docker help -> writing to file in a seperate container

I have 2 docker file/containers where one is a next app and another one is a go server, is there a way in which I can manipulate my next js files from my golang container, chatgpt says a shared volume, but I am not able to make it work (see the next js dir and write to it ). if you want my docker-compose.yaml ->
services: go_app: restart: always build: context: . dockerfile: Dockerfile.go_app ports: - "4696:4696" nextjs: restart: always build: context: . dockerfile: Dockerfile ports: - "3000:3000" services: go_app: restart: always build: context: . dockerfile: Dockerfile.go_app ports: - "4696:4696" nextjs: restart: always build: context: . dockerfile: Dockerfile ports: - "3000:3000"
my next js dockerfile ->

FROM node:21-alpine3.18 AS node-build WORKDIR /app COPY package.json package-lock.json ./ RUN npm install COPY . . FROM node:latest WORKDIR /app COPY --from=node-build /app/. . EXPOSE 3000 EXPOSE 3333 Command to run both Go and Next.js CMD npm run dev
my go_app docker file ->
FROM golang:latest AS golangBuild WORKDIR /app COPY go.mod go.mod EXPOSE 4696 COPY a.go a.go RUN go build -o goserver . Expose port CMD [ "./goserver" ]
1 Reply
Mango Juicy
Mango Juicy8mo ago
What is the ultimate goal? What do you solve by separating into 2 docker containers and editing one from another?
Want results from more Discord servers?
Add your server