Skip to content
Snippets Groups Projects
Dockerfile 1.01 KiB
Newer Older
  • Learn to ignore specific revisions
  • ARG GOLANG_VERSION=1.23
    
    Malte Bauch's avatar
    Malte Bauch committed
    ARG BUILDARGS
    
    ARG GITLAB_PROXY
    
    Malte Bauch's avatar
    Malte Bauch committed
    
    
    FROM ${GITLAB_PROXY}golang:${GOLANG_VERSION}-bookworm AS builder
    
    Malte Bauch's avatar
    Malte Bauch committed
    ARG GITLAB_LOGIN
    ARG GITLAB_TOKEN
    RUN echo "machine code.fbi.h-da.de login ${GITLAB_LOGIN} password ${GITLAB_TOKEN}" > ~/.netrc
    
    WORKDIR /app/
    
    RUN apt-get update && apt-get upgrade -y
    
    COPY . .
    
    Malte Bauch's avatar
    Malte Bauch committed
    RUN --mount=type=cache,target=/root/go/pkg/mod \
        --mount=type=cache,target=/root/.cache/go-build \
    
        make build-gokms
    
    Malte Bauch's avatar
    Malte Bauch committed
    
    
    RUN go install github.com/go-delve/delve/cmd/dlv@latest
    
    FROM ${GITLAB_PROXY}debian:12-slim AS debug
    RUN apt-get update && apt-get upgrade -y
    COPY --from=builder /app/artifacts/goKMS /usr/bin/goKMS
    COPY --from=builder /go/bin/dlv /usr/bin/dlv
    
    EXPOSE 7030
    EXPOSE 50910
    EXPOSE 1337
    ENTRYPOINT ["/usr/bin/dlv", "--listen=0.0.0.0:1337", "--headless=true", "--api-version=2", "run", "/usr/bin/goKMS"]
    
    FROM ${GITLAB_PROXY}debian:12-slim AS debian
    
    Malte Bauch's avatar
    Malte Bauch committed
    RUN apt-get update && apt-get upgrade -y
    
    COPY --from=builder app/artifacts/goKMS /usr/bin/goKMS
    
    Malte Bauch's avatar
    Malte Bauch committed
    EXPOSE 7030
    
    ENTRYPOINT ["/usr/bin/goKMS"]