-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile
31 lines (21 loc) · 1.07 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
ARG BUILDPLATFORM="linux/amd64"
FROM --platform=$BUILDPLATFORM golang:1.21-alpine as build
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN apk add --no-cache git
COPY ./ /go/src/github.com/itfactory-tm/thomas-bot
WORKDIR /go/src/github.com/itfactory-tm/thomas-bot
RUN export GOARM=6 && \
export GOARCH=amd64 && \
if [ "$TARGETPLATFORM" == "linux/arm64" ]; then export GOARCH=arm64; fi && \
if [ "$TARGETPLATFORM" == "linux/arm" ]; then export GOARCH=arm; fi && \
go build -ldflags "-X main.revision=$(git rev-parse --short HEAD)" ./cmd/thomas/
FROM alpine:3.18
RUN apk add --no-cache ca-certificates
RUN mkdir -p /go/src/github.com/itfactory-tm/thomas-bot/thomas-bot
WORKDIR /go/src/github.com/itfactory-tm/thomas-bot/thomas-bot
COPY ./sounds /go/src/github.com/itfactory-tm/thomas-bot/thomas-bot/sounds
COPY ./www /go/src/github.com/itfactory-tm/thomas-bot/thomas-bot/www
COPY ./config.json /go/src/github.com/itfactory-tm/thomas-bot/thomas-bot/
COPY --from=build /go/src/github.com/itfactory-tm/thomas-bot/thomas /usr/local/bin/
CMD [ "/usr/local/bin/thomas", "serve" ]