-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
121 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ docker-compose.yaml | |
Dockerfile | ||
Pipfile | ||
Pipfile.lock | ||
.env.example | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
AZURE_STORAGE_CONNECTION_STRING= | ||
AZURE_STORAGE_CONTAINER= | ||
AZ_ROOT_FILE_PATH= | ||
LOCAL_DOWNLOAD_PATH= | ||
LOCAL_DOWNLOAD_PATH= | ||
SSH_USERS= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,38 @@ | ||
# Use the GDAL image as the base | ||
FROM ghcr.io/osgeo/gdal:ubuntu-full-3.10.0 | ||
|
||
ARG GROUPNAME="cbsurge" | ||
|
||
# Install necessary tools and Python packages | ||
RUN apt-get update && \ | ||
apt-get install -y python3-pip pipenv gcc cmake libgeos-dev && \ | ||
apt-get install -y python3-pip pipenv gcc cmake libgeos-dev openssh-server && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# install azure-cli | ||
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash | ||
|
||
RUN mkdir /var/run/sshd && \ | ||
echo 'PermitRootLogin no' >> /etc/ssh/sshd_config && \ | ||
echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
# Create a group and set permissions for /app | ||
RUN groupadd ${GROUPNAME} && \ | ||
usermod -aG ${GROUPNAME} root && \ | ||
mkdir -p /app && \ | ||
chown -R :${GROUPNAME} /app && \ | ||
chmod -R g+rwx /app | ||
|
||
RUN chmod +x /app/create_user.sh | ||
RUN chmod +x /app/entrypoint.sh | ||
|
||
# install package | ||
RUN pipenv --python 3 && pipenv run pip install -e . | ||
|
||
CMD [ "pipenv", "run", "rapida", "--help"] | ||
EXPOSE 22 | ||
|
||
ENTRYPOINT ["/app/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
USERNAME=$1 | ||
PASSWORD=$2 | ||
GROUPNAME=cbsurge | ||
|
||
# skip if user already exists | ||
if id "$USERNAME" &>/dev/null; then | ||
echo "User $USERNAME already exists." | ||
else | ||
# create new user | ||
useradd -m -s /bin/bash "$USERNAME" | ||
echo "$USERNAME:$PASSWORD" | chpasswd | ||
echo "User $USERNAME created." | ||
|
||
# Add the user to the group | ||
usermod -aG $GROUPNAME "$USERNAME" | ||
echo "User $USERNAME added to $GROUPNAME group." | ||
|
||
# Grant sudo access (optional) | ||
usermod -aG sudo "$USERNAME" | ||
echo "User $USERNAME granted sudo privileges." | ||
fi | ||
|
||
# Set ownership of /app folder to the user | ||
chown -R "$USERNAME:$USERNAME" /app | ||
echo "Ownership of /app granted to $USERNAME." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
# Create multiple users from environment variable SSH_USERS | ||
# Format: SSH_USERS="user1:password1 user2:password2 user3:password3" | ||
if [ ! -z "$SSH_USERS" ]; then | ||
for user_info in $SSH_USERS; do | ||
IFS=':' read -r username password <<< "$user_info" | ||
if [ ! -z "$username" ] && [ ! -z "$password" ]; then | ||
/app/create_user.sh "$username" "$password" | ||
else | ||
echo "Invalid user format: $user_info" | ||
fi | ||
done | ||
fi | ||
|
||
# launch ssh server | ||
/usr/sbin/sshd -D |