Skip to content

How can I get hot reloading work in docker? 🤗  #102

@hcancelik

Description

@hcancelik

Question description
I'm having trouble getting the hot reloading working with fiber dev inside a docker container.

Here is my Dockerfile.

FROM golang:1.18-alpine as build

WORKDIR /go/src/api

RUN go install github.com/gofiber/cli/fiber@latest

COPY . .

RUN go mod download

CMD ["fiber", "dev"]

Here is my docker-compose file.

services:
  db:
    image: mongo:5.0.7
    restart: always
    ports:
      - 27017:27017
    volumes:
      - mongodb:/data/db
    environment:
      MONGO_INITDB_ROOT_USERNAME: ${DB_USERNAME:-root}
      MONGO_INITDB_ROOT_PASSWORD: ${DB_PASSWORD:-password}

  api:
    depends_on:
      - db
    build:
      context: ./api
      target: build
    restart: always
    ports:
      - 3000:3000
    volumes:
      - ./api:/app

volumes:
  mongodb:

I do see the files being changed inside the container but I cannot get the fiber cli to restart the fiber. What I might be missing?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🤔 QuestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions