6 Commits

Author SHA1 Message Date
Shubham Agrawal be769618aa updated dockerfile for arm 2021-05-06 20:10:24 +05:30
Shubham Agrawal 487521c8bc provided 777 to /home/drone 2021-05-06 19:39:42 +05:30
Shubham Agrawal 79700f47fe Allow non-root user to run git clone plugin 2021-05-06 19:12:05 +05:30
Brad Rydzewski 41c2120a63 improve logs indicating HOME directory created 2021-05-04 21:17:22 -04:00
Brad Rydzewski 9a0e8cc9d6 create HOME directory if not exists 2021-05-04 21:16:15 -04:00
Brad Rydzewski 16f4dd8829 revert to alpine 3.12 due to dns issue 2021-05-04 21:07:07 -04:00
7 changed files with 64 additions and 19 deletions
+8 -3
View File
@@ -1,5 +1,10 @@
FROM alpine:3.13
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli
FROM alpine:3.12
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
ADD posix/* /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/clone"]
RUN adduser -g Drone -s /bin/sh -D -u 1000 drone
RUN echo 'drone ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/drone
USER drone:drone
RUN chmod -R 777 /home/drone
ENTRYPOINT ["/usr/local/bin/clone"]
+6 -2
View File
@@ -1,5 +1,9 @@
FROM arm32v6/alpine:3.13
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl
FROM arm32v6/alpine:3.12
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
ADD posix/* /usr/local/bin/
RUN adduser -g Drone -s /bin/sh -D -u 1000 drone
RUN echo 'drone ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/drone
USER drone:drone
RUN chmod -R 777 /home/drone
ENTRYPOINT ["/usr/local/bin/clone"]
+6 -2
View File
@@ -1,5 +1,9 @@
FROM arm32v6/alpine:3.13
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl
FROM arm32v6/alpine:3.12
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
ADD posix/* /usr/local/bin/
RUN adduser -g Drone -s /bin/sh -D -u 1000 drone
RUN echo 'drone ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/drone
USER drone:drone
RUN chmod -R 777 /home/drone
ENTRYPOINT ["/usr/local/bin/clone"]
+6 -2
View File
@@ -1,5 +1,9 @@
FROM arm64v8/alpine:3.13
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl
FROM arm64v8/alpine:3.12
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
ADD posix/* /usr/local/bin/
RUN adduser -g Drone -s /bin/sh -D -u 1000 drone
RUN echo 'drone ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/drone
USER drone:drone
RUN chmod -R 777 /home/drone
ENTRYPOINT ["/usr/local/bin/clone"]
+6 -2
View File
@@ -1,5 +1,9 @@
FROM arm32v6/alpine:3.13
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl
FROM arm32v6/alpine:3.12
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
ADD posix/* /usr/local/bin/
RUN adduser -g Drone -s /bin/sh -D -u 1000 drone
RUN echo 'drone ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/drone
USER drone:drone
RUN chmod -R 777 /home/drone
ENTRYPOINT ["/usr/local/bin/clone"]
+6 -2
View File
@@ -1,5 +1,9 @@
FROM arm64v8/alpine:3.13
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl
FROM arm64v8/alpine:3.12
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
ADD posix/* /usr/local/bin/
RUN adduser -g Drone -s /bin/sh -D -u 1000 drone
RUN echo 'drone ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/drone
USER drone:drone
RUN chmod -R 777 /home/drone
ENTRYPOINT ["/usr/local/bin/clone"]
+26 -6
View File
@@ -1,14 +1,34 @@
#!/bin/sh
if [[ ! -z "${DRONE_WORKSPACE}" ]]; then
if [[ -n "${CI}" ]]; then
sudo mkdir -p ${DRONE_WORKSPACE}
sudo chown drone:drone ${DRONE_WORKSPACE}
else
mkdir -p ${DRONE_WORKSPACE}
fi
cd ${DRONE_WORKSPACE}
fi
# we default home directory to /home/drone
if [ "$HOME" != "/home/drone" ]; then
export HOME=/home/drone
fi
# if the home directory does not exist it should
# be created.
if [ ! -d "${HOME}" ]; then
echo "HOME directory does not exist; creating ${HOME}"
mkdir -p ${HOME}
fi
# if the netrc enviornment variables exist, write
# the netrc file.
if [[ ! -z "${DRONE_NETRC_MACHINE}" ]]; then
cat <<EOF > /root/.netrc
cat <<EOF > ${HOME}/.netrc
machine ${DRONE_NETRC_MACHINE}
login ${DRONE_NETRC_USERNAME}
password ${DRONE_NETRC_PASSWORD}
@@ -20,12 +40,12 @@ fi
# known hosts file.
if [[ ! -z "${DRONE_SSH_KEY}" ]]; then
mkdir /root/.ssh
echo -n "$DRONE_SSH_KEY" > /root/.ssh/id_rsa
chmod 600 /root/.ssh/id_rsa
mkdir ${HOME}/.ssh
echo -n "$DRONE_SSH_KEY" > ${HOME}/.ssh/id_rsa
chmod 600 ${HOME}/.ssh/id_rsa
touch /root/.ssh/known_hosts
chmod 600 /root/.ssh/known_hosts
touch ${HOME}/.ssh/known_hosts
chmod 600 ${HOME}/.ssh/known_hosts
ssh-keyscan -H ${DRONE_NETRC_MACHINE} > /etc/ssh/ssh_known_hosts 2> /dev/null
fi