forked from lmas/d0020e_code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (23 loc) · 797 Bytes
/
Dockerfile
File metadata and controls
34 lines (23 loc) · 797 Bytes
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
# Documentation: https://docs.docker.com/reference/dockerfile/
FROM golang:1.23-alpine AS builder
WORKDIR /src/
# Copy and download dependencies first (utilising docker's build caches in a better way)
COPY go.mod go.sum ./
RUN go mod download
# Copy the rest of the source and compile it
ARG SRC
COPY $SRC ./
RUN go build -o system
################################################################################
# Run a clean container runtime (without any build tools)
FROM alpine:3.21 AS final
# Install dependencies
RUN apk add curl
# Copies generated files from the builder
COPY --from=builder /src/system /
WORKDIR /data
# Runs periodic healthchecks on the system
ARG PORT
HEALTHCHECK --interval=1m CMD curl -f "http://localhost:$PORT/" || exit 1
# Run the system
CMD ["/system"]