-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (33 loc) · 1.41 KB
/
Dockerfile
File metadata and controls
45 lines (33 loc) · 1.41 KB
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
37
38
39
40
41
42
43
44
45
# GLEAM ------------------------------------------------------------------------
FROM ghcr.io/gleam-lang/gleam:v1.11.0-erlang-alpine AS builder_gleam
WORKDIR /usr/src/app
COPY jst_lustre ./jst_lustre
WORKDIR /usr/src/app/jst_lustre
RUN apk add --no-cache nodejs npm
RUN gleam test
RUN gleam run -m lustre/dev build --minify --tailwind-entry=./src/styles.css --outdir=../build
# GO ----------------------------------------------------------------------------
FROM golang:1.23.3-alpine AS builder_go
WORKDIR /usr/src/app
COPY server/go.mod server/go.sum ./
RUN go mod download -x || (sleep 5 && go mod download -x) || (sleep 10 && go mod download -x) && \
go mod verify
# Install linting tools
# RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
# RUN go install github.com/securego/gosec/v2/cmd/gosec@latest
# RUN go install honnef.co/go/tools/cmd/staticcheck@latest
# copy server code
COPY ./server .
# Run code quality checks
# RUN gosec ./... #is very picky and slow
# RUN golangci-lint run --timeout=5m
# RUN staticcheck ./...
# RUN go vet ./...
# RUN go test -race ./... #requires cgo
# Add frontend code
COPY --from=builder_gleam /usr/src/app/build ./web/static
RUN go build -v -o /run-app .
# RUNNER ------------------------------------------------------------------------
FROM gcr.io/distroless/base-debian12 AS runner
COPY --from=builder_go /run-app /usr/local/bin/
ENTRYPOINT ["run-app"]