Skip to content

Instantly share code, notes, and snippets.

@kouk
Created March 17, 2021 14:06
Show Gist options
  • Save kouk/0d040076c496b1d3d3f4431ba9efb358 to your computer and use it in GitHub Desktop.
Save kouk/0d040076c496b1d3d3f4431ba9efb358 to your computer and use it in GitHub Desktop.
Build mozilla/sops@develop with docker

Build mozilla/sops with age support using Docker

How to build the development branch of https://github.com/mozilla/sops/ and age using Docker:

make

How to test:

./bin/age-keygen -o key.txt
mkdir -p ~/.config/sops/age
cat key.txt >> ~/.config/sops/age/keys.txt
echo "foo: bar" > test.yaml
./bin/sops --age $(./bin/age-keygen -y key.txt) -i -e test.yaml
./bin/sops -d test.yaml
FROM golang:1.15 AS build
WORKDIR /build
RUN go mod init example.com/sops-build \
&& go get -u go.mozilla.org/sops/v3/cmd/sops@develop
RUN go get -u filippo.io/age/cmd/...
FROM scratch AS bin
COPY --from=build /go/bin/sops /
all: bin/sops
.PHONY: bin/sops
export DOCKER_BUILDKIT = 1
bin/sops:
@docker build . --target bin \
--output bin/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment