-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docker: build multiarchitecture images
- Loading branch information
Showing
3 changed files
with
89 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,34 @@ | ||
FROM golang:1.23-alpine AS build | ||
FROM golang:alpine AS build | ||
ARG TARGETARCH | ||
|
||
COPY . /usr/local/src/go-carbon | ||
RUN apk add --update git make bash \ | ||
&& cd /usr/local/src/go-carbon \ | ||
&& make go-carbon \ | ||
&& chmod +x go-carbon && cp -fv go-carbon /tmp | ||
RUN apk add --update git make bash gcc musl-dev | ||
|
||
FROM alpine:3 | ||
USER nobody:nogroup | ||
WORKDIR /usr/local/src/go-carbon | ||
COPY --chown=nobody:nogroup . . | ||
RUN --mount=type=cache,id=go-cache,target=/.cache,sharing=locked,uid=65534,gid=65534 make go-carbon | ||
RUN --mount=type=cache,id=go-cache,target=/.cache,sharing=locked,uid=65534,gid=65534 <<EOT | ||
if [ "${TARGETARCH:-unknown}" = "amd64" ]; then | ||
make run-test COMMAND="test -race" | ||
else | ||
make run-test COMMAND="test" || true | ||
fi | ||
EOT | ||
|
||
RUN addgroup -S carbon && adduser -S carbon -G carbon \ | ||
&& mkdir -p /var/lib/graphite/whisper /var/lib/graphite/dump /var/lib/graphite/tagging /var/log/go-carbon /etc/go-carbon/ \ | ||
&& chown -R carbon:carbon /var/lib/graphite/ /var/log/go-carbon | ||
FROM alpine:latest | ||
|
||
COPY --from=build /tmp/go-carbon /usr/sbin/go-carbon | ||
ADD go-carbon.conf.example /etc/go-carbon/go-carbon.conf | ||
RUN --network=none addgroup -S carbon && adduser -S carbon -G carbon \ | ||
&& mkdir -p /var/lib/graphite/whisper /etc/go-carbon/ \ | ||
&& chown -R carbon:carbon /var/lib/graphite/ | ||
|
||
COPY --chown=0:0 --from=build /usr/local/src/go-carbon/go-carbon /usr/sbin/go-carbon | ||
ADD go-carbon.docker.conf /etc/go-carbon/go-carbon.conf | ||
ADD deploy/storage*.conf /etc/go-carbon/ | ||
RUN --network=none /usr/sbin/go-carbon -config-print-default > /etc/go-carbon/go-carbon.default.conf | ||
|
||
USER carbon | ||
CMD ["/usr/sbin/go-carbon", "-daemon=false", "-config", "/etc/go-carbon/go-carbon.conf"] | ||
ENTRYPOINT ["/usr/sbin/go-carbon"] | ||
CMD ["-config", "/etc/go-carbon/go-carbon.conf"] | ||
|
||
EXPOSE 2003 2004 7002 7003 7007 8080 2003/udp | ||
EXPOSE 2003/tcp 2003/udp 8080 | ||
VOLUME /var/lib/graphite /etc/go-carbon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
[whisper] | ||
enabled = true | ||
data-dir = "/var/lib/graphite/whisper" | ||
schemas-file = "/etc/go-carbon/storage-schemas.conf" | ||
aggregation-file = "/etc/go-carbon/storage-aggregation.conf" | ||
sparse-create = true | ||
|
||
[cache] | ||
max-size = 1000000 | ||
write-strategy = "noop" | ||
bloom-size = 0 | ||
|
||
[udp] | ||
listen = ":2003" | ||
enabled = true | ||
buffer-size = 0 | ||
|
||
[tcp] | ||
listen = ":2003" | ||
enabled = true | ||
buffer-size = 0 | ||
|
||
[carbonserver] | ||
listen = ":8080" | ||
enabled = true | ||
|
||
[pickle] | ||
enabled = false | ||
|
||
[grpc] | ||
enabled = false | ||
|
||
[carbonlink] | ||
enabled = false | ||
|
||
[dump] | ||
enabled = false | ||
|
||
[[logging]] | ||
logger = "" | ||
file = "stdout" | ||
level = "error" | ||
encoding = "console" | ||
encoding-time = "" | ||
encoding-duration = "" |