Opa: RPM packages for Centos 7

Created on 2 Mar 2020  路  8Comments  路  Source: open-policy-agent/opa

We have a base Centos 7 Docker image. We are trying to install OPA on Centos 7 and create a single Docker image and thus a single container. Does OPA has RPM packages? If yes, could you please share the location?

Based on our research we found https://pkgs.org/download/opa-libopamgt, please let us know if this is official that we can use in production environments?

question

Most helpful comment

All 8 comments

OPA does not currently publish any RPM packages. The easiest option for you would to just have OPA get downloaded as part of your custom CentOS image build (instructions https://www.openpolicyagent.org/docs/latest/#1-download-opa)

If you want a more secure approach (if downloading binaries isn't ok) you can always use a builder image and just make OPA from source, if you use the golang docker image you just need the OPA source code, then run make build-linux, and copy the binary into your final CentOS image https://docs.docker.com/develop/develop-images/multistage-build/

@patrick-east , is there a TAR file at least? We already have a different Docker image that is being pulled as part of my Dockerfile (apart FROM Centos) and that is the reason I wanted to avoid pulling golang Docker image so that my Dockerfile is simple.

A tar file of what?

The opa binary is available for download, that is the simplest option.

@patrick-east , i downloaded the source and trying to build the binary, but i am getting below error:


Step 5/5 : RUN cd opa-src-files && make build-linux
 ---> Running in 9959ffacf47e
fatal: Not a git repository (or any of the parent directories): .git
make[1]: Entering directory '/usr/local/opa-src-files'
fatal: Not a git repository (or any of the parent directories): .git
Docker not installed. Skipping OPA-WASM library build.
GO111MODULE=on GOFLAGS=-mod=vendor go generate
go run: no go files listed
main.go:23: running "build/run-pigeon.sh": exit status 1
Makefile:51: recipe for target 'generate' failed
make[1]: Leaving directory '/usr/local/opa-src-files'
make[1]: *** [generate] Error 1
Makefile:185: recipe for target 'build-linux' failed
make: *** [build-linux] Error 2
The command '/bin/sh -c cd opa-src-files && make build-linux' returned a non-zero code: 2

Below is the snippet of Dockerfile:


FROM golang:1.7.3
WORKDIR /usr/local
RUN mkdir -p opa-src-files
ADD opa opa-src-files

RUN cd opa-src-files && make build-linux

I am new to Go, please advise. It would be nice if we have some kind of documentation which explains steps to build from source.

There are instructions to build in https://github.com/open-policy-agent/opa/blob/master/docs/devel/DEVELOPMENT.md

I think the version of Golang is too old. Try using one >=1.13, https://hub.docker.com/_/golang. I had success with:

FROM golang:1.13.8

WORKDIR /usr/local
RUN git clone http://github.com/open-policy-agent/opa.git
RUN cd opa && make build-linux

@kadimulam were you able to get OPA building in the container?

Closing this out, future progress for RPM packages will be tracked in #2210

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hauleth picture hauleth  路  9Comments

omerlh picture omerlh  路  9Comments

povilasv picture povilasv  路  4Comments

gshively11 picture gshively11  路  8Comments

priyanka-5 picture priyanka-5  路  5Comments