feat: convert the user_deploy into a dockerfile
This commit is contained in:
parent
f5b842547a
commit
1f2f2f0e8d
4 changed files with 40 additions and 22 deletions
8
deploy_user/Dockerfile
Normal file
8
deploy_user/Dockerfile
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Container image that runs your code
|
||||||
|
FROM node:22-bullseye
|
||||||
|
|
||||||
|
# Copies your code file from your action repository to the filesystem path `/` of the container
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
|
# Code file to execute when the docker container starts up (`entrypoint.sh`)
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
@ -7,7 +7,7 @@ inputs:
|
||||||
username:
|
username:
|
||||||
description: 'Pass in your skynet username'
|
description: 'Pass in your skynet username'
|
||||||
required: false
|
required: false
|
||||||
default: ${{ env.GITHUB_REPOSITORY_OWNER }}
|
default: "${{ env.GITHUB_REPOSITORY_OWNER }}"
|
||||||
folder:
|
folder:
|
||||||
description: 'Folder to upload, normally build'
|
description: 'Folder to upload, normally build'
|
||||||
required: true
|
required: true
|
||||||
|
@ -16,23 +16,10 @@ inputs:
|
||||||
required: false
|
required: false
|
||||||
default: ""
|
default: ""
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: 'docker'
|
||||||
steps:
|
image: 'Dockerfile'
|
||||||
- name: "Set SSH key"
|
args:
|
||||||
shell: bash
|
- ${{ inputs.username }}
|
||||||
run: |
|
- ${{ inputs.ssh_key }}
|
||||||
# jank I know
|
- ${{ inputs.folder }}
|
||||||
echo "${{ inputs.ssh_key }}" > tmp.key
|
- ${{ github.destination }}
|
||||||
chmod 600 tmp.key
|
|
||||||
- name: "Ensure public_html exists"
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
ssh -v -i tmp.key ${{ inputs.username }}@skynet.skynet.ie "mkdir -p ~/public_html && chmod 711 ~ || true && chmod -R 755 ~/public_html || true"
|
|
||||||
- name: "Ensure destination exists"
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
ssh -v -i tmp.key ${{ inputs.username }}@skynet.skynet.ie "mkdir -p ~/public_html/${{ inputs.destination }}"
|
|
||||||
- name: "Copy files across"
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
scp -v -i tmp.key -r ${{ inputs.folder }}/* ${{ inputs.username }}@skynet.skynet.ie:/home/${{ inputs.username }}/public_html/${{ inputs.destination }}
|
|
23
deploy_user/entrypoint.sh
Executable file
23
deploy_user/entrypoint.sh
Executable file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
export USERNAME=$1
|
||||||
|
export SSH_KEY=$2
|
||||||
|
export FOLDER=$3
|
||||||
|
export DESTINATION=$4
|
||||||
|
|
||||||
|
echo $USERNAME
|
||||||
|
echo $FOLDER
|
||||||
|
echo $DESTINATION
|
||||||
|
|
||||||
|
# jank I know
|
||||||
|
echo "$SSH_KEY" > tmp.key
|
||||||
|
chmod 600 tmp.key
|
||||||
|
|
||||||
|
# ensure teh public_html is created and has right permissions
|
||||||
|
ssh -v -i tmp.key ${USERNAME}@skynet.skynet.ie "mkdir -p ~/public_html && chmod 711 ~ || true && chmod -R 755 ~/public_html || true"
|
||||||
|
|
||||||
|
# ensure output folder exists
|
||||||
|
ssh -v -i tmp.key ${USERNAME}@skynet.skynet.ie "mkdir -p ~/public_html/${DESTINATION}"
|
||||||
|
|
||||||
|
# copy files across
|
||||||
|
scp -v -i tmp.key -r ${FOLDER}/* ${USERNAME}@skynet.skynet.ie:/home/${USERNAME}/public_html/${DESTINATION}
|
|
@ -1,5 +1,5 @@
|
||||||
# Container image that runs your code
|
# Container image that runs your code
|
||||||
FROM node:16-bullseye
|
FROM node:22-bullseye
|
||||||
|
|
||||||
# make sure dependencies are installed
|
# make sure dependencies are installed
|
||||||
RUN apt-get -y update
|
RUN apt-get -y update
|
||||||
|
|
Loading…
Reference in a new issue