Skip to content

Instantly share code, notes, and snippets.

@gordalina
Last active November 5, 2022 02:02
Show Gist options
  • Save gordalina/49ee677dbe50587ec8e2c6c6c90e2aa6 to your computer and use it in GitHub Desktop.
Save gordalina/49ee677dbe50587ec8e2c6c6c90e2aa6 to your computer and use it in GitHub Desktop.
Tier as a sidercar in docker compose
version: '3.9'
services:
tier:
build:
context: .
dockerfile: Dockerfile
target: release
args:
- TIER_VERSION=v0.4.2
entrypoint: tier serve
ports:
- 8080:8080
volumes:
- ~/.config/tier:/home/tier/.config/tier:cached
######################################
FROM golang:1.19-alpine3.16 as builder
ARG TIER_VERSION
ENV TIER_VERSION=${TIER_VERSION}
WORKDIR /go/tier
ENV CGO_ENABLED=0
RUN apk add git alpine-sdk
RUN set -ex \
&& git clone https://github.com/tierrun/tier.git -b $TIER_VERSION /go/tier \
&& go build -ldflags "-linkmode external -extldflags -static" -a ./cmd/tier
######################################
FROM alpine:3.16 as release
RUN addgroup -S tier \
&& adduser -S tier -G tier
USER tier
COPY --from=builder --chown=tier:tier /go/tier/tier /usr/bin/tier
ENTRYPOINT ["tier"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment