37 lines
1.3 KiB
Docker
37 lines
1.3 KiB
Docker
# Copyright (C) 2026 Dcntrlized
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as published
|
|
# by the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
# syntax=docker/dockerfile:1
|
|
|
|
FROM golang:1.25-alpine AS build
|
|
RUN apk add --no-cache git ca-certificates
|
|
# addlicense is deliberately the same binary/version the Gitea workflow uses.
|
|
RUN go install github.com/google/[email protected]
|
|
WORKDIR /src
|
|
COPY go.mod ./
|
|
COPY . .
|
|
ARG VERSION=0.0.1
|
|
RUN CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=${VERSION}" -o /out/license-bot .
|
|
|
|
FROM alpine:3.22
|
|
RUN apk add --no-cache git ca-certificates \
|
|
&& adduser -D -u 10001 -h /home/bot bot
|
|
COPY --from=build /out/license-bot /usr/local/bin/license-bot
|
|
COPY --from=build /go/bin/addlicense /usr/local/bin/addlicense
|
|
USER bot
|
|
WORKDIR /home/bot
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["license-bot"]
|