Skip to content

Commit

Permalink
pga-create: add the select-repos.sh and index-repos.sh scripts to the…
Browse files Browse the repository at this point in the history
… repository to be copied into the docker image

Signed-off-by: Manuel Carmona <manu.carmona90@gmail.com>
  • Loading branch information
mcarmonaa committed Mar 20, 2019
1 parent 8df69e6 commit 95632e4
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 16 deletions.
21 changes: 5 additions & 16 deletions PublicGitArchive/pga-create/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#==========================================================================
# Stage 1: build pga-create and create select-repos and index-repos scripts
#==========================================================================
#==========================
# Stage 1: build pga-create
#==========================
FROM golang:1.12.0-alpine3.9 AS builder

# build pga-create
Expand All @@ -9,19 +9,8 @@ ENV PGA_CREATE_PATH=$GOPATH/src/$PGA_CREATE_REPO
COPY . ${PGA_CREATE_PATH}
RUN go build -tags norwfs -o /bin/pga-create ${PGA_CREATE_PATH}/cmd/pga-create

# select-repos command
RUN echo -e '#!/bin/sh \n\
pga-create discover && \
pga-create select -m $STARS >/pga/data/pga.list'>/bin/select-repos && \
chmod +x /bin/select-repos

# index-repos command
RUN echo -e '#!/bin/sh \n\
CONFIG_ROOT_REPOSITORIES_DIR=/pga/root-repositories CONFIG_CLEAN_TEMP_DIR=true CONFIG_BUCKETSIZE=$BUCKET_SIZE \
pga-create index --debug --repos-file=/pga/data/pga.list && \
pga-create set-forks -f /pga/data/index.csv -o /pga/data/index_$PGA_VERSION.csv &&\
tar -czf /pga/root-repositories/index_$PGA_VERSION.tar.gz -C /pga/data/ index_$PGA_VERSION.csv'>/bin/index-repos && \
chmod +x /bin/index-repos
RUN cp ${PGA_CREATE_PATH}/select-repos.sh /bin/select-repos && chmod +x /bin/select-repos
RUN cp ${PGA_CREATE_PATH}/index-repos.sh /bin/index-repos && chmod +x /bin/index-repos

RUN wget -q -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64 && \
chmod +x /usr/local/bin/dumb-init
Expand Down
18 changes: 18 additions & 0 deletions PublicGitArchive/pga-create/index-repos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

# This script is intended to be used inside the docker image for
# https://github.com/src-d/datasets/tree/master/PublicGitArchive/pga-create
# The absolut paths refers to mounted volumes inside the docker container.
# See the Dockerfile for more information.

set -e

CONFIG_ROOT_REPOSITORIES_DIR=/pga/root-repositories \
CONFIG_CLEAN_TEMP_DIR=true \
CONFIG_BUCKETSIZE=$BUCKET_SIZE \
pga-create index --debug --repos-file=/pga/data/pga.list

pga-create set-forks -f /pga/data/index.csv -o /pga/data/index_$PGA_VERSION.csv

tar -czf /pga/root-repositories/index_$PGA_VERSION.tar.gz -C /pga/data/ index_$PGA_VERSION.csv

12 changes: 12 additions & 0 deletions PublicGitArchive/pga-create/select-repos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

# This script is intended to be used inside the docker image for
# https://github.com/src-d/datasets/tree/master/PublicGitArchive/pga-create
# The absolut paths refers to mounted volumes inside the docker container.
# See the Dockerfile for more information.

set -e

pga-create discover
pga-create select -m $STARS >/pga/data/pga.list

0 comments on commit 95632e4

Please sign in to comment.