Skip to content

Commit 43d7c84

Browse files
committed
The features dockerile will build.
CI will still fail as it will need secrets to be able to handle the ssh keys.
1 parent 003b2f9 commit 43d7c84

File tree

3 files changed

+42
-11
lines changed

3 files changed

+42
-11
lines changed

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ PODS_BASE=pods
2828
PODS_DIRS=$(dir $(wildcard $(PODS_BASE)/*/))
2929
# Users can set the BUILD_TYPE={devel,release}
3030
BUILD_TYPE=devel
31+
# Users can set the specific ssh file used for github. The key or filename
32+
# should contain a public and private key. You can find these files in
33+
# ~/.ssh.
34+
SSH_FILENAME=github_ed25519
3135

36+
prv_key_file=~/.ssh/${SSH_FILENAME}
37+
pub_key_file=~/.ssh/${SSH_FILENAME}.pub
38+
prv_key=$(shell cat $(prv_key_file) | sed '/-----BEGIN OPENSSH PRIVATE KEY-----/d' | sed '/-----END OPENSSH PRIVATE KEY-----/d')
39+
pub_key=$(shell cat $(pub_key_file))
3240

3341
install:
3442
mkdir -p $(INSTALL_DIR)
@@ -39,7 +47,7 @@ images:
3947
pushd $$dir; \
4048
local_dir=$${PWD##*/}; \
4149
dirname=$${local_dir:-/}; \
42-
docker build . -t $${dirname}:latest --build-arg build=$(BUILD_TYPE); \
50+
docker build . -t $${dirname}:latest --build-arg build=$(BUILD_TYPE) --build-arg ssh_prv_key="${prv_key}" --build-arg ssh_pub_key="${pub_key}" --squash; \
4351
popd; \
4452
done
4553

pods/features/Dockerfile

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ from fedora:latest
2424
MAINTAINER "barbacbd@gmail.com"
2525

2626
ARG build
27+
ARG ssh_prv_key
28+
ARG ssh_pub_key
2729

2830
# Update all packages
2931
RUN dnf update -y
@@ -39,18 +41,39 @@ RUN if [[ ! -z "$build" ]] && [[ "$build" == "devel" ]]; then dnf install -y ema
3941
# upgrade pip
4042
RUN python3 -m pip install pip --upgrade
4143

44+
# Authorize SSH Host
45+
RUN mkdir -p /root/.ssh && \
46+
chmod 0700 /root/.ssh
47+
48+
# If either key is invalid then this will not continue.
49+
# The format for the private key should not include the comments
50+
# for the begin and end of the key sections (see makefile for more info).
51+
RUN if [ -z "$ssh_prv_key" ] || [ -z "$ssh_pub_key" ]; then \
52+
exit 1;\
53+
fi
54+
55+
RUN echo "-----BEGIN OPENSSH PRIVATE KEY-----" >> /root/.ssh/github_ed25519 && \
56+
sed -e 's/ /\n/g' <<< "$ssh_prv_key" >> /root/.ssh/github_ed25519 >> /root/.ssh/github_ed25519 && \
57+
echo "-----END OPENSSH PRIVATE KEY-----" >> /root/.ssh/github_ed25519 && \
58+
echo "$ssh_pub_key" > /root/.ssh/github_ed25519.pub && \
59+
chmod 600 /root/.ssh/github_ed25519 && \
60+
chmod 600 /root/.ssh/github_ed25519.pub
61+
62+
RUN echo "IdentityFile ~/.ssh/github_ed25519" >> /root/.ssh/config
63+
RUN echo "" >> /root/.ssh/config
64+
RUN echo "Host github.com" >> /root/.ssh/config
65+
RUN echo " AddKeysToAgent yes" >> /root/.ssh/config
66+
RUN echo " IdentityFile ~/.ssh/github_ed25519" >> /root/.ssh/config
67+
# The following line is required or git will require yes/no answers in the prompt that
68+
# don't work with the option (yes | <command> )
69+
RUN echo " StrictHostKeyChecking no" >> /root/.ssh/config
4270

4371
RUN export LD_LIBRARY_PATH=/usr/lib/:/usr/local/lib:$LD_LIBRARY_PATH
4472

45-
RUN git clone https://github.com/Craigacp/MIToolbox.git
73+
74+
RUN git clone git@github.com:Craigacp/MIToolbox.git
4675
RUN cd MIToolbox && make clean && make && make install
4776
RUN cd ..
4877

49-
RUN git clone https://github.com/barbacbd/FEAST.git
50-
RUN cd FEAST
51-
RUN RUN git checkout pyfeast_v2
52-
RUN make clean && make && make install
53-
54-
RUN cd python
55-
RUN python3 -m pip install . --upgrade
56-
78+
RUN git clone git@github.com:barbacbd/FEAST.git
79+
RUN cd FEAST && git fetch && git branch -v -a && git checkout remotes/origin/pyfeast_v2 && rm -rf MIToolbox && ln -s /MIToolbox .&& make clean && make && make install && cd -

predictor/Predictor.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ while getopts b:d:hx flag
172172
do
173173
case "${flag}" in
174174
b) BuildType=${OPTARG};;
175-
d) SourceDir=${OPTARG};;
175+
d) SourceDir=${OPTARG};;
176176
h) HELP; exit 1;;
177177
x) set -eux;;
178178
esac

0 commit comments

Comments
 (0)