all repos — disgord @ 3a034bb6b48b5d3c4f3a82de32d6832dced7f99b

A simple Discord bot in Go.

Dockerfile (view raw)

 1# syntax=docker/dockerfile:1
 2
 3FROM golang:1.23-alpine AS builder
 4
 5# RUN apk add --no-cache git
 6
 7WORKDIR /build
 8
 9# Download Git submodules
10# COPY .git ./.git
11# RUN git -c submodule.ui.update=none submodule update --init --recursive
12
13# Download Go modules
14COPY go.mod go.sum ./
15RUN go mod download
16RUN go mod verify
17
18# Transfer source code
19COPY .git/refs/heads/main ./commitID
20COPY *.go ./
21COPY src ./src
22
23# Build
24RUN commit_hash=$(cat commitID | cut -c1-7) && \
25    CGO_ENABLED=0 go build -ldflags "-X github.com/BiRabittoh/disgord/src.CommitID=$commit_hash" -trimpath -o /dist/app
26
27
28# Test
29FROM builder AS run-test-stage
30# COPY i18n ./i18n
31RUN go test -v ./...
32
33FROM scratch AS build-release-stage
34
35WORKDIR /app
36
37COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
38COPY --from=builder /dist .
39# COPY i18n ./i18n
40# COPY publi[c] ./public
41
42ENTRYPOINT ["./app"]