Skip to content

Commit 1d9e03f

Browse files
authored
Merge pull request #1 from PatternAtlas/update-qc-patterns
Enable to clone a single branch
2 parents dcccbb1 + 26a7eff commit 1d9e03f

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ FROM postgres:12
22

33
LABEL MAINTAINER Manuela Weigold <[email protected]>
44

5-
ENV PATTERN_ATLAS_CONTENT_REPOSITORY_URL "https://github.com/PatternPedia/pattern-atlas-content.git"
6-
ENV PATTERN_ATLAS_PRIVATE_CONTENT_REPOSITORY_URL "[email protected]:PatternPedia/internal-pattern-atlas-content.git"
5+
ENV PATTERN_ATLAS_CONTENT_REPOSITORY_URL "https://github.com/PatternAtlas/pattern-atlas-content.git"
6+
ENV PATTERN_ATLAS_PRIVATE_CONTENT_REPOSITORY_URL "[email protected]:PatternAtlas/internal-pattern-atlas-content.git"
7+
ENV PATTERN_ATLAS_CONTENT_REPOSITORY_BRANCH "master"
78
ENV SUBFOLDER_CONTENT_REPO_BACKUP_FILES "db-backup-files"
89
ENV COPY_CONTENT_REPOSITORY_TARGET_PATH "/var/pattern-atlas/testdata"
910
ENV POSTGRES_PASSWORD postgres
@@ -21,4 +22,4 @@ RUN apt-get update \
2122
COPY clone-data-repo.sh clone-data-repo.sh
2223

2324
# if ssh key is set, clone data repo with the sql scripts for initalization and start postgres afterwards
24-
CMD chmod 700 clone-data-repo.sh && ./clone-data-repo.sh && su postgres -c "/usr/local/bin/docker-entrypoint.sh postgres"
25+
CMD chmod 700 clone-data-repo.sh && ./clone-data-repo.sh && su postgres -c "/usr/local/bin/docker-entrypoint.sh postgres"

clone-data-repo.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ if test -f "$FILE"; then
1111
mkdir /root/.ssh/ && cp /run/secrets/ssh_secret /root/.ssh/id_rsa
1212
chmod 400 /root/.ssh/id_rsa && ssh-keyscan github.com >> /root/.ssh/known_hosts
1313
# clone repo
14-
git clone ${PATTERN_ATLAS_PRIVATE_CONTENT_REPOSITORY_URL} ${COPY_CONTENT_REPOSITORY_TARGET_PATH}
14+
git clone --single-branch --branch ${PATTERN_ATLAS_CONTENT_REPOSITORY_BRANCH} ${PATTERN_ATLAS_PRIVATE_CONTENT_REPOSITORY_URL} ${COPY_CONTENT_REPOSITORY_TARGET_PATH}
15+
echo "cloned ${PATTERN_ATLAS_CONTENT_REPOSITORY_BRANCH} of ${PATTERN_ATLAS_PRIVATE_CONTENT_REPOSITORY_URL}"
1516
else
1617
echo "ssh key not present, proceeding with public db"
1718
# clone repo
18-
git clone ${PATTERN_ATLAS_CONTENT_REPOSITORY_URL} ${COPY_CONTENT_REPOSITORY_TARGET_PATH}
19+
git clone --single-branch --branch ${PATTERN_ATLAS_CONTENT_REPOSITORY_BRANCH} ${PATTERN_ATLAS_CONTENT_REPOSITORY_URL} ${COPY_CONTENT_REPOSITORY_TARGET_PATH}
20+
echo "cloned ${PATTERN_ATLAS_CONTENT_REPOSITORY_BRANCH} of ${PATTERN_ATLAS_CONTENT_REPOSITORY_URL}"
1921
fi
2022
#copy the file with the sql statements to the folder that is executed on startup of the postgres db
2123
mv ${COPY_CONTENT_REPOSITORY_TARGET_PATH}/${SUBFOLDER_CONTENT_REPO_BACKUP_FILES}/* /docker-entrypoint-initdb.d/

0 commit comments

Comments
 (0)