Before buildx test
This commit is contained in:
@@ -2,13 +2,20 @@
|
|||||||
ARG IMAGE=unityci/base:latest
|
ARG IMAGE=unityci/base:latest
|
||||||
FROM ${IMAGE}
|
FROM ${IMAGE}
|
||||||
|
|
||||||
|
ARG SERIAL
|
||||||
|
ARG USERNAME
|
||||||
|
ARG PASSWORD
|
||||||
|
|
||||||
RUN apt update
|
RUN apt update
|
||||||
RUN apt install -y wget chromium-browser
|
RUN apt install -y wget chromium-browser
|
||||||
|
|
||||||
COPY entrypoint.sh /
|
|
||||||
RUN chmod +x /entrypoint.sh
|
|
||||||
|
|
||||||
ADD https://minio.studiowhy.net/hackmd/UnityBuilder /usr/local/bin/
|
ADD https://minio.studiowhy.net/hackmd/UnityBuilder /usr/local/bin/
|
||||||
RUN chmod +x /usr/local/bin/UnityBuilder
|
RUN chmod +x /usr/local/bin/UnityBuilder
|
||||||
|
|
||||||
|
COPY entrypoint.sh /
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
|
COPY scripts/. /scripts
|
||||||
|
RUN bash /scripts/activate_license.sh ${SERIAL} ${USERNAME} ${PASSWORD}
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
@@ -6,28 +6,10 @@ rm -rf $HOME/.config/unity3d
|
|||||||
rm -rf /home/unity/.config/unity3d
|
rm -rf /home/unity/.config/unity3d
|
||||||
|
|
||||||
#Add ssh key information for resolving packages.
|
#Add ssh key information for resolving packages.
|
||||||
if [[ -n "$SSH_PUBLIC_KEY" && -n "$SSH_PRIVATE_KEY" ]]; then
|
bash /scripts/add_ssh_keys.sh
|
||||||
echo "ADDING SSH KEYS!"
|
|
||||||
SSH_DIR="/home/$(whoami)/.ssh"
|
|
||||||
mkdir -p $SSH_DIR
|
|
||||||
|
|
||||||
echo "$SSH_PUBLIC_KEY" > $SSH_DIR/id_rsa.pub
|
if [[ "$SERIAL" != "activated" ]]; then
|
||||||
echo "$SSH_PRIVATE_KEY" > $SSH_DIR/id_rsa
|
bash /scripts/activate_license.sh "$SERIAL" "$EMAIL" "$PASSWORD"
|
||||||
cat << EOF > $SSH_DIR/config
|
|
||||||
Host *
|
|
||||||
StrictHostKeyChecking no
|
|
||||||
EOF
|
|
||||||
|
|
||||||
chmod 600 $SSH_DIR/id_rsa
|
|
||||||
chmod 644 $SSH_DIR/id_rsa.pub
|
|
||||||
cat $SSH_DIR/config
|
|
||||||
fi
|
|
||||||
|
|
||||||
#Activate Unity
|
|
||||||
if [[ "$SERIAL" == "personal" ]]; then
|
|
||||||
UnityBuilder activate -i /usr/bin/unity-editor -u $EMAIL -p $PASSWORD
|
|
||||||
else
|
|
||||||
unity-editor $DEFAULT_ARGS -serial $SERIAL -username $EMAIL -password $PASSWORD
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Run the command.
|
#Run the command.
|
||||||
|
|||||||
13
unity-command/scripts/activate_license.sh
Normal file
13
unity-command/scripts/activate_license.sh
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SERIAL=$1; EMAIL=$2; PASSWORD=$3;
|
||||||
|
|
||||||
|
if [[ -z "$SERIAL" || -z "$EMAIL" || -z "$PASSWORD" ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#Activate Unity
|
||||||
|
if [[ "$SERIAL" == "personal" ]]; then
|
||||||
|
UnityBuilder activate -i /usr/bin/unity-editor -u $EMAIL -p $PASSWORD
|
||||||
|
else
|
||||||
|
unity-editor $DEFAULT_ARGS -serial $SERIAL -username $EMAIL -password $PASSWORD
|
||||||
|
fi
|
||||||
17
unity-command/scripts/add_ssh_keys.sh
Normal file
17
unity-command/scripts/add_ssh_keys.sh
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [[ -n "$SSH_PUBLIC_KEY" && -n "$SSH_PRIVATE_KEY" ]]; then
|
||||||
|
echo "ADDING SSH KEYS!"
|
||||||
|
SSH_DIR="/home/$(whoami)/.ssh"
|
||||||
|
mkdir -p $SSH_DIR
|
||||||
|
|
||||||
|
echo "$SSH_PUBLIC_KEY" > $SSH_DIR/id_rsa.pub
|
||||||
|
echo "$SSH_PRIVATE_KEY" > $SSH_DIR/id_rsa
|
||||||
|
cat << EOF > $SSH_DIR/config
|
||||||
|
Host *
|
||||||
|
StrictHostKeyChecking no
|
||||||
|
EOF
|
||||||
|
|
||||||
|
chmod 600 $SSH_DIR/id_rsa
|
||||||
|
chmod 644 $SSH_DIR/id_rsa.pub
|
||||||
|
cat $SSH_DIR/config
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user