-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (37 loc) · 1.85 KB
/
Dockerfile
File metadata and controls
52 lines (37 loc) · 1.85 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
46
47
48
49
50
51
52
FROM golang:1.25.4-alpine3.22 as builder
# Install dependencies
RUN apk add --no-cache make gcc musl-dev linux-headers
WORKDIR /app/influxcli
ENV INFLUXDB_VERSION=2.7.5
# wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-2.7.5-linux-amd64.tar.gz
# wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-2.7.5-linux-arm64.tar.gz
# depending on the architecture, download the appropriate version of the influxdb2-client
RUN case "$(uname -m)" in \
x86_64) wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-${INFLUXDB_VERSION}-linux-amd64.tar.gz && \
tar xvzf ./influxdb2-client-${INFLUXDB_VERSION}-linux-amd64.tar.gz ;; \
aarch64) wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-${INFLUXDB_VERSION}-linux-arm64.tar.gz && \
tar xvzf ./influxdb2-client-${INFLUXDB_VERSION}-linux-arm64.tar.gz ;; \
*) echo "Unsupported architecture"; exit 1 ;; \
esac
# Set the Current Working Directory inside the container
WORKDIR /app
COPY go.mod .
COPY go.sum .
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
RUN go mod download
# Copy the source from the current directory to the Working Directory inside the container
COPY . .
# Build the Go app
RUN go build -o thorflux ./cmd/
FROM alpine:3.20
# Install runtime deps (jq for JSON processing, git for cloning owners repo, CA certs for HTTPS)
RUN apk add --no-cache jq git ca-certificates && update-ca-certificates
# Copy the Pre-built binary file from the previous stage
COPY --from=builder /app/thorflux /app/thorflux
COPY --from=builder /app/influxcli/influx /usr/local/bin/influx
WORKDIR /app
COPY entrypoint.sh /app/entrypoint.sh
# This container exposes port 8080 to the outside world
EXPOSE 8080
# Run the binary program produced by `go build`
ENTRYPOINT ["sh", "entrypoint.sh"]