problem with hosting docker with volumes

Hi, what I am trying to do is mount my magic-first-website-next/ in both the containers (such that anyone can write to it and both containers see the changes ), but the problem is that when I go to my container I see only node modules inside it, my docker-compose.yaml->

services:
  nextjs_app:
    # restart: always
    # command: tail -f /dev/null  
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - ./magic-first-website-next:/app
      - /app/node_modules
    ports:
      - 3000:3000

  go_app:
    build:
      context: .
      dockerfile: Dockerfile.go_app
    ports:
      - "4696:4696"
    volumes:
      - ./magic-first-website-next:/go/src/app

my dockerFile->

# Stage 2: Build the Next.js app
# Use the official Node.js 14 image as a base
FROM node:22-alpine AS base
# FROM node:latest AS base

FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
WORKDIR /app

COPY magic-first-website-next/package.json magic-first-website-next/yarn.lock* magic-first-website-next/package-lock.json* magic-first-website-next/pnpm-lock.yaml* ./
RUN npm install

FROM base AS builder
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
# COPY . .


EXPOSE 3000

ENV PORT 3000

CMD ["npm", "run", "dev"]

dockerFile.go_app->

FROM golang:latest AS golangBuild
# Set the current working directory inside the container
WORKDIR /app
# Copy the Go module files
COPY magic-first-website-next/go.mod go.mod
# 3333
EXPOSE 4696
# Download and install Go dependencies
# VOLUME /home/monish/code/react/magic-first-website-next
# RUN go mod download
# Copy the rest of the application source code
COPY magic-first-website-next/a.go a.go
# Build the Go app
RUN go build -o goserver .
# Expose port
CMD [ "./goserver" ]

Fly.toml->


app = 'deploy-to-fly-morning-resonance-8636'
primary_region = 'sin'

[build]

[http_service]
  internal_port = 3000
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0
  processes = ['app']

[[services]]
  protocol = 'tcp'
  internal_port = 3000

  [[services.ports]]
    port = 3000
    handlers = ['http']

[[services]]
  protocol = 'tcp'
  internal_port = 4696

  [[services.ports]]
    port = 4696
    handlers = ['http']

[[vm]]
  memory = '1gb'
  cpu_kind = 'shared'
  cpus = 1

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.