# Build stage
FROM golang:1.19-alpine AS builder
RUN apk add --no-cache
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY . .
RUN CGO_ENABLED=0 go build -o ./bin/main ./cmd/api/main.go
# Run stage
FROM alpine:3.16
RUN apk add --no-cache
RUN mkdir /plfa
WORKDIR plfa
RUN adduser dsha256 --disabled-password --no-create-home
RUN chown -R dsha256:dsha256 /plfa
RUN chmod -R 755 /plfa
COPY --from=builder ./app/bin/main ./
COPY --from=builder ./app/.env ./
RUN export $(grep -v '^#' .env | xargs -d '\n')
CMD [ "./main" ]
USER dsha256
Here's the SERVER_PORT definition from my .env file:
SERVER_PORT=8080
What is the problem with these files?
I did some research and in most cases, the problem is caused by incorrect syntax or extra spaces, but in my case, everything seems like correct in that perspective.
When I'm trying to run
docker compose up
ordocker compose up --build
commands, I get the following error:This is my
Docker
file's content:This -
docker-compose.yml
Here's the
SERVER_PORT
definition from my.env
file:What is the problem with these files?
I did some research and in most cases, the problem is caused by incorrect syntax or extra spaces, but in my case, everything seems like correct in that perspective.