Skip to content

Go does not rebuild when .env file is changed #86

Description

@xiaoming857

Dockerfile:

FROM golang:1.20

ENV GO111MODULE=on \
    CGO_ENABLED=0 \
    GOOS=linux \
    GOARCH=amd64

WORKDIR /server

COPY go.mod .
COPY go.sum .
RUN go mod download

COPY cmd ./cmd/
COPY pkg ./pkg/
COPY .env .

RUN go get github.com/githubnemo/CompileDaemon
RUN go install github.com/githubnemo/CompileDaemon

ENTRYPOINT CompileDaemon -polling -log-prefix=false -build="go build -o bin/app ./cmd/api/main.go" -command="./bin/app" -directory="./"

I had tried adding -include=.env or -include=".env" or -include="\.env" but still to no avail. Is this a normal behaviour, which the .env file being exempted from the auto-reload? Or did I miss something?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions