mirror of
https://github.com/drone/drone-git.git
synced 2026-06-14 05:12:54 +08:00
Compare commits
6 Commits
v1.2.0
...
drone_non_root
| Author | SHA1 | Date | |
|---|---|---|---|
| be769618aa | |||
| 487521c8bc | |||
| 79700f47fe | |||
| 41c2120a63 | |||
| 9a0e8cc9d6 | |||
| 16f4dd8829 |
@@ -1,5 +1,10 @@
|
|||||||
FROM alpine:3.13
|
FROM alpine:3.12
|
||||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli
|
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
|
||||||
|
|
||||||
ADD posix/* /usr/local/bin/
|
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"]
|
ENTRYPOINT ["/usr/local/bin/clone"]
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
FROM arm32v6/alpine:3.13
|
FROM arm32v6/alpine:3.12
|
||||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl
|
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
|
||||||
|
|
||||||
ADD posix/* /usr/local/bin/
|
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"]
|
ENTRYPOINT ["/usr/local/bin/clone"]
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
FROM arm32v6/alpine:3.13
|
FROM arm32v6/alpine:3.12
|
||||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl
|
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
|
||||||
|
|
||||||
ADD posix/* /usr/local/bin/
|
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"]
|
ENTRYPOINT ["/usr/local/bin/clone"]
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
FROM arm64v8/alpine:3.13
|
FROM arm64v8/alpine:3.12
|
||||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl
|
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
|
||||||
|
|
||||||
ADD posix/* /usr/local/bin/
|
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"]
|
ENTRYPOINT ["/usr/local/bin/clone"]
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
FROM arm32v6/alpine:3.13
|
FROM arm32v6/alpine:3.12
|
||||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl
|
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
|
||||||
|
|
||||||
ADD posix/* /usr/local/bin/
|
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"]
|
ENTRYPOINT ["/usr/local/bin/clone"]
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
FROM arm64v8/alpine:3.13
|
FROM arm64v8/alpine:3.12
|
||||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl
|
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
|
||||||
|
|
||||||
ADD posix/* /usr/local/bin/
|
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"]
|
ENTRYPOINT ["/usr/local/bin/clone"]
|
||||||
|
|||||||
+26
-6
@@ -1,14 +1,34 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if [[ ! -z "${DRONE_WORKSPACE}" ]]; then
|
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}
|
cd ${DRONE_WORKSPACE}
|
||||||
fi
|
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
|
# if the netrc enviornment variables exist, write
|
||||||
# the netrc file.
|
# the netrc file.
|
||||||
|
|
||||||
if [[ ! -z "${DRONE_NETRC_MACHINE}" ]]; then
|
if [[ ! -z "${DRONE_NETRC_MACHINE}" ]]; then
|
||||||
cat <<EOF > /root/.netrc
|
cat <<EOF > ${HOME}/.netrc
|
||||||
machine ${DRONE_NETRC_MACHINE}
|
machine ${DRONE_NETRC_MACHINE}
|
||||||
login ${DRONE_NETRC_USERNAME}
|
login ${DRONE_NETRC_USERNAME}
|
||||||
password ${DRONE_NETRC_PASSWORD}
|
password ${DRONE_NETRC_PASSWORD}
|
||||||
@@ -20,12 +40,12 @@ fi
|
|||||||
# known hosts file.
|
# known hosts file.
|
||||||
|
|
||||||
if [[ ! -z "${DRONE_SSH_KEY}" ]]; then
|
if [[ ! -z "${DRONE_SSH_KEY}" ]]; then
|
||||||
mkdir /root/.ssh
|
mkdir ${HOME}/.ssh
|
||||||
echo -n "$DRONE_SSH_KEY" > /root/.ssh/id_rsa
|
echo -n "$DRONE_SSH_KEY" > ${HOME}/.ssh/id_rsa
|
||||||
chmod 600 /root/.ssh/id_rsa
|
chmod 600 ${HOME}/.ssh/id_rsa
|
||||||
|
|
||||||
touch /root/.ssh/known_hosts
|
touch ${HOME}/.ssh/known_hosts
|
||||||
chmod 600 /root/.ssh/known_hosts
|
chmod 600 ${HOME}/.ssh/known_hosts
|
||||||
ssh-keyscan -H ${DRONE_NETRC_MACHINE} > /etc/ssh/ssh_known_hosts 2> /dev/null
|
ssh-keyscan -H ${DRONE_NETRC_MACHINE} > /etc/ssh/ssh_known_hosts 2> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user