# Build image
FROM golang:1.21-alpine AS build

ENV GOPRIVATE coopcloud.tech

RUN apk add --no-cache \
  gcc \
  git \
  make \
  musl-dev

COPY . /app

WORKDIR /app

RUN CGO_ENABLED=0 make build

# Release image ("slim")
FROM alpine:3.19.1

RUN apk add --no-cache \
  ca-certificates \
  git \
  openssh

RUN update-ca-certificates

COPY --from=build /app/abra /abra

ENTRYPOINT ["/abra"]
