-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.watch
51 lines (37 loc) · 1.63 KB
/
Dockerfile.watch
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
46
47
48
49
50
51
### Build the go app
FROM golang:1-alpine AS go-builder
WORKDIR /app
COPY src/api/go.* .
RUN go mod download
COPY src/api/*.go .
RUN CGO_ENABLED=0 GOOS=linux go build -o /dash
### Build the web app
FROM node:20-alpine AS web-builder
COPY src/static/style.css ./src/
COPY src/static/fonts ./src/fonts
RUN npx esbuild src/style.css --bundle --minify --loader:.woff2=file --outfile=/build/style.css
COPY src/static ./src
RUN npx esbuild src/js/app.js --format=esm --bundle --minify --outfile=/build/app.js
### Build the final image
FROM alpine AS runner
LABEL org.opencontainers.image.title "dash"
LABEL org.opencontainers.image.description "A minimalist Docker landing page with services auto-discovery."
LABEL org.opencontainers.image.url="https://github.com/codename-co/dash"
LABEL org.opencontainers.image.documentation='https://github.com/codename-co/dash/wiki'
LABEL org.opencontainers.image.source='https://github.com/codename-co/dash'
LABEL org.opencontainers.image.vendor='codename'
LABEL org.opencontainers.image.authors='https://codename.co'
LABEL org.opencontainers.image.licenses='MIT'
ENTRYPOINT ["/dash"]
ENV PORT 80
EXPOSE $PORT
# TODO: Handle health checks
# COPY --from=alpine:3 /usr/bin/wget /bin/wget
# HEALTHCHECK --interval=1s --timeout=1s --start-period=2s --retries=3 CMD [ "/bin/wget", "--spider", "http://0.0.0.0:${PORT}/health" ]
COPY --from=go-builder /dash /dash
COPY src/static/index.html ./static/
COPY src/static/favicon.svg ./static/
COPY src/static/js/[^app]* ./static/js/
COPY --from=web-builder /build/style.css* ./static/
COPY --from=web-builder /build/*.woff2 ./static/
COPY --from=web-builder /build/app.js* ./static/js/