# Build stage
FROM golang:1.21 AS build-env
ENV GO111MODULE=on

# Set /app as the working directory
WORKDIR /app

# Copy all files to /app
COPY . .
COPY .env .env

# Install dependencies
RUN go mod download && go mod verify
RUN go mod tidy -v

# Build the Go application
RUN CGO_ENABLED=0 GOOS=linux go build -v -installsuffix cgo -o app cmd/main.go

# final
FROM ubuntu:20.04

RUN apt-get update -y
RUN apt-get -y install wget


COPY --from=build-env /app/app .
COPY --from=build-env /app/.env .env


EXPOSE 8080

# Define the command to run the application
CMD ["./app"]
