Files
rpmbuild/Dockerfile
Belden Lyman 7b5a254a87 Make rpmbuild work with private repos
Previously, in order to create /github/home/rpmbuild/SOURCES/foo-1.2.0.tar.gz,
rpmbuild did the following:

1. use curl to download a tarball of the project source
2. unpack it into a local directory
3. repack it with the correct desired directory structure
4. move the repacked tarball to /github/home/rpmbuild/SOURCES

This failed for me at step 1 because the repo I'm trying to use rpmbuild on
is a private repo. There's no means of plumbing a github auth token into the
`curl` command, so the tarball fails to download and everything else fails.

----

Since we have the current repo tree in /github/workspace, we can coerce `git`
to make the archive for us. Now, we:

1. ask git to make the archive

and everything works with a private repo. In order to make this approach work,
I've added `git` into the build container.
2021-09-17 16:37:25 -07:00

25 lines
835 B
Docker

# Using CentOS 7 as base image to support rpmbuild (packages will be Dist el7)
FROM centos:7
# Copying all contents of rpmbuild repo inside container
COPY . .
# Installing tools needed for rpmbuild ,
# depends on BuildRequires field in specfile, (TODO: take as input & install)
RUN yum install -y rpm-build rpmdevtools gcc make coreutils python git
# Setting up node to run our JS file
# Download Node Linux binary
RUN curl -O https://nodejs.org/dist/v12.16.1/node-v12.16.1-linux-x64.tar.xz
# Extract and install
RUN tar --strip-components 1 -xvf node-v* -C /usr/local
# Install all dependecies to execute main.js
RUN npm install --production
# All remaining logic goes inside main.js ,
# where we have access to both tools of this container and
# contents of git repo at /github/workspace
ENTRYPOINT ["node", "/lib/main.js"]