-
Notifications
You must be signed in to change notification settings - Fork 10
Build and publish Docker images #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| ARG GO_VERSION=1.25 | ||
| ARG BINARY_SOURCE=builder | ||
|
|
||
| # When performing a multi-platform build, leverage Go's built-in support for | ||
| # cross-compilation instead of relying on emulation (which is much slower). | ||
| # See: https://docs.docker.com/build/building/multi-platform/#cross-compiling-a-go-application | ||
| FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS builder | ||
| ARG TARGETOS | ||
| ARG TARGETARCH | ||
|
|
||
| # Download dependencies to local module cache | ||
| WORKDIR /src | ||
| RUN --mount=type=bind,source=go.sum,target=go.sum \ | ||
| --mount=type=bind,source=go.mod,target=go.mod \ | ||
| --mount=type=cache,target=/go/pkg/mod \ | ||
| go mod download -x | ||
|
|
||
| # Build static executable | ||
| RUN --mount=type=bind,target=. \ | ||
| --mount=type=cache,target=/go/pkg/mod \ | ||
| --mount=type=cache,target=/root/.cache/go-build \ | ||
| GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 go build -o /bin/tiger ./cmd/tiger | ||
|
|
||
| # When building Docker images via GoReleaser, to binaries are built externally | ||
| # and copied in. See: https://goreleaser.com/customization/dockers_v2/ | ||
| FROM scratch AS release | ||
| ARG TARGETPLATFORM | ||
| COPY ${TARGETPLATFORM}/tiger /bin/tiger | ||
|
|
||
| # Either the 'builder' or 'release' stage, depending on whether we're building | ||
| # the binaries in Docker or outside via GoReleaser. | ||
| FROM ${BINARY_SOURCE} AS binary_source | ||
|
|
||
| # Create final alpine image | ||
| FROM alpine:3.23 AS final | ||
|
|
||
| # Install psql for sake of `tiger db connect` | ||
| RUN apk add --update --no-cache postgresql-client | ||
|
|
||
| # Create non-root user/group | ||
| RUN addgroup -g 1000 tiger && adduser -u 1000 -G tiger -D tiger | ||
| USER tiger | ||
| WORKDIR /home/tiger | ||
|
|
||
| # Set env vars to control default Tiger CLI behavior | ||
| ENV TIGER_PASSWORD_STORAGE=pgpass | ||
| ENV TIGER_CONFIG_DIR=/home/tiger/.config/tiger | ||
|
|
||
| # Declare config file mount points | ||
| VOLUME /home/tiger/.config/tiger | ||
| VOLUME /home/tiger/.pgpass | ||
|
|
||
| # Copy binary to final image | ||
| COPY --from=binary_source /bin/tiger /usr/local/bin/tiger | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I take it that an env var isn't allowed here, to just use
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that's right, you can't use an env var in |
||
|
|
||
| ENTRYPOINT ["tiger"] | ||
| CMD ["mcp", "start"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| services: | ||
| tiger-cli: | ||
| build: | ||
| context: . | ||
| dockerfile: ./Dockerfile | ||
| develop: | ||
| watch: | ||
| - action: rebuild | ||
| path: ./ | ||
| image: ghcr.io/timescale/tiger-cli:${TAG:-latest} | ||
| container_name: tiger-cli | ||
| environment: | ||
| - TIGER_PUBLIC_KEY | ||
| - TIGER_SECRET_KEY | ||
| ports: | ||
| - 8080:8080 | ||
| volumes: | ||
| - type: bind | ||
| source: ${HOME}/.config/tiger | ||
| target: /home/tiger/.config/tiger | ||
| - type: bind | ||
| source: ${HOME}/.pgpass | ||
| target: /home/tiger/.pgpass |
Uh oh!
There was an error while loading. Please reload this page.