DEVELOPMENT ENVIRONMENT

~liljamo/felu

ref: f9956b2cdb7c170d8cb2163421cbf5f50cd858c7 felu/Dockerfile -rw-r--r-- 876 bytes
f9956b2cJonni Liljamo feat: refresh tsigKey frontend, revamp reused components 27 days 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
29
30
31
32
33
34
35
36
# builder
FROM golang:1.22.7-alpine3.20 AS builder

RUN apk update && apk add gcc musl-dev

ARG VERSION=notset-dockerfile

WORKDIR /usr/src/app

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

RUN go install github.com/a-h/templ/cmd/templ@$(go list -m -f '{{ .Version }}' github.com/a-h/templ)

COPY cmd/ ./cmd
COPY internal/ ./internal

RUN templ generate --path internal/components

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

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

# release
FROM alpine:3.20 AS release

COPY --from=builder /felu /felu
COPY --from=builder /usr/src/app/internal/components /usr/src/app/internal/components
ADD ./static /static

RUN mkdir /var/felu

ENTRYPOINT ["/felu"]