# BUILD
FROM gitea.pena/penadevops/container-images/golang:main as build

# Update packages and clear cache
# Set work directory
WORKDIR /app
# Create binary directory
RUN mkdir /app/bin -p
ADD . .
# Download go depences
RUN go mod download
# Build app
RUN GOOS=linux go build -o bin ./...

# PRODUCTION
FROM gitea.pena/penadevops/container-images/alpine:main

# Install packages
RUN apk --no-cache add ca-certificates
# Create home directory
WORKDIR /app
# Copy build file
COPY --from=build /app/bin/app ./app
COPY ./report.docx ./report.docx
# CMD
CMD ["./app"]
