DEVELOPMENT ENVIRONMENT

~liljamo/tixe

ref: 122737fd9a39acff16ad8d57b6e24ac30a7ddfaf tixe/Dockerfile -rw-r--r-- 547 bytes
122737fdJonni Liljamo feat: maybe possibly only build on tags? 1 year, 1 month ago
                                                                                
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
# builder
FROM golang:1.21.0-alpine AS builder

ARG VERSION=notset-dockerfile

WORKDIR /usr/src/app

COPY go.mod go.sum ./
RUN go mod download && go mod verify

COPY . .

RUN --mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=linux go build -ldflags=-X=main.version=${VERSION} -v -o /tixe ./tixe.go

# tester
FROM builder AS tester
RUN --mount=type=cache,target=/root/.cache/go-build go test -v ./...

# release
FROM alpine:3.18 AS release

COPY --from=builder /tixe /tixe
ADD ./static /static

EXPOSE 8080

ENTRYPOINT ["/tixe"]