kabanero-io / kabanero-command-line-services

This repo will be archived soon.
Apache License 2.0
3 stars 7 forks source link

Docker make build-image fails on line "make binary-local" #189

Closed jabcuga closed 4 years ago

jabcuga commented 4 years ago

I ran command: IMAGE=jabcuga/kabanero-command-line-services:latest-amd64 make build-image

and the build fails with:

GO111MODULE=on go build -mod=vendor "-buildmode=pie" -ldflags "-X main.gitCommit=" -gcflags "" -tags "btrfs_noversion exclude_graphdriver_btrfs libdm_no_deferred_remove " -o skopeo ./cmd/skopeo

runtime/cgo

fork/exec /usr/bin/gcc: permission denied make: * [Makefile:104: binary-local] Error 2 The command '/bin/sh -c REPOLIST=ubi-8-baseos,ubi-8-codeready-builder,ubi-8-appstream SKOPEO_VERSION_NAME=0.1.40 SKOPEO_SRC_PKG_NAME=v${SKOPEO_VERSION_NAME}.tar.gz SKOPEO_SRC_ROOT_NAME=skopeo-${SKOPEO_VERSION_NAME} INSTALL_PKGS="ostree-libs" TEMP_BUILD_UBI_PKGS="wget make golang gpgme-devel libassuan-devel device-mapper-devel" && yum -y update-minimal --disablerepo "" --enablerepo ubi-8 --setopt=tsflags=nodocs yum repolist && yum -y install --disablerepo "" --enablerepo ${REPOLIST} --setopt=tsflags=nodocs ${INSTALL_PKGS} ${TEMP_BUILD_UBI_PKGS} && GOPATH=$(pwd) && mkdir -p /src/github.com/containers && cd /src/github.com/containers && wget https://github.com/containers/skopeo/archive/${SKOPEO_SRC_PKG_NAME} && tar -xzpf ${SKOPEO_SRC_PKG_NAME} && mv ${SKOPEO_SRC_ROOT_NAME} skopeo && cd skopeo && make binary-local && mv skopeo /usr/local/bin && mkdir -p /etc/containers && echo $'{\n \"default\": [\n {\n \"type\": \"insecureAcceptAnything\"\n }\n ]\n}' > /etc/containers/policy.json && cat /etc/containers/policy.json' returned a non-zero code: 2 Makefile:12: recipe for target 'build-image' failed make: [build-image] Error 2

In trying to diagnose the issue, I started breaking up the commands into individual RUN commands.

This works for me, but might not be the right solution as I think the original command was attempting to reduce the number of temporary Docker images by concatenating the commands.

`## Note: The UBI has different repos than the RHEL repos. RUN REPOLIST=ubi-8-baseos,ubi-8-codeready-builder,ubi-8-appstream \

Add your package needs here

SKOPEO_VERSION_NAME=0.1.40 \
SKOPEO_SRC_PKG_NAME=v${SKOPEO_VERSION_NAME}.tar.gz \
SKOPEO_SRC_ROOT_NAME=skopeo-${SKOPEO_VERSION_NAME} \
INSTALL_PKGS="ostree-libs" \
TEMP_BUILD_UBI_PKGS="wget make golang gpgme-devel libassuan-devel device-mapper-devel" && \
yum -y update-minimal --disablerepo "*" --enablerepo ubi-8* --setopt=tsflags=nodocs \
yum repolist && \
yum -y install --disablerepo "*" --enablerepo ${REPOLIST} --setopt=tsflags=nodocs ${INSTALL_PKGS} ${TEMP_BUILD_UBI_PKGS} && \

Install your application here -- add all other necessary items to build your image

GOPATH=$(pwd) && \
mkdir -p /src/github.com/containers && \
cd /src/github.com/containers && \
wget https://github.com/containers/skopeo/archive/${SKOPEO_SRC_PKG_NAME} && \
tar -xzpf ${SKOPEO_SRC_PKG_NAME} && \
mv ${SKOPEO_SRC_ROOT_NAME} skopeo

RUN cd /src/github.com/containers/skopeo && make binary-local RUN cd /src/github.com/containers/skopeo && mv skopeo /usr/local/bin && mkdir -p /etc/containers

Create required config file

RUN echo $'{\n \"default\": [\n {\n \"type\": \"insecureAcceptAnything\"\n }\n ]\n}' > /etc/containers/policy.json RUN cat /etc/containers/policy.json`

davco01a commented 4 years ago

## Note: The UBI has different repos than the RHEL repos.
RUN REPOLIST=ubi-8-baseos,ubi-8-codeready-builder,ubi-8-appstream \
### Add your package needs here
    SKOPEO_VERSION_NAME=0.1.40 \
    SKOPEO_SRC_PKG_NAME=v${SKOPEO_VERSION_NAME}.tar.gz \
    SKOPEO_SRC_ROOT_NAME=skopeo-${SKOPEO_VERSION_NAME} \
    INSTALL_PKGS="ostree-libs" \
    TEMP_BUILD_UBI_PKGS="wget make golang gpgme-devel libassuan-devel device-mapper-devel" && \
    yum -y update-minimal --disablerepo "*" --enablerepo ubi-8* --setopt=tsflags=nodocs \
    yum repolist && \
    yum -y install --disablerepo "*" --enablerepo ${REPOLIST} --setopt=tsflags=nodocs ${INSTALL_PKGS} ${TEMP_BUILD_UBI_PKGS} && \
### Install your application here -- add all other necessary items to build your image
    GOPATH=$(pwd) && \
    mkdir -p /src/github.com/containers && \
    cd /src/github.com/containers && \
    wget https://github.com/containers/skopeo/archive/${SKOPEO_SRC_PKG_NAME} && \
    tar -xzpf ${SKOPEO_SRC_PKG_NAME} && \
    mv ${SKOPEO_SRC_ROOT_NAME} skopeo
RUN cd /src/github.com/containers/skopeo && make binary-local
RUN cd /src/github.com/containers/skopeo &&  mv skopeo /usr/local/bin &&  mkdir -p /etc/containers
    # Create required config file
RUN   echo $'{\n    \"default\": [\n        {\n            \"type\": \"insecureAcceptAnything\"\n        }\n    ]\n}' >  /etc/containers/policy.json
RUN   cat /etc/containers/policy.json
davco01a commented 4 years ago

fixed and merged