Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ✨ add apk for alpine support #1672

Merged
merged 10 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .scripts/enable_docker_service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -Eeuo pipefail
IFS=$'\n\t'

enable_docker_service() {
DOCKER_SERVICE_ENABLE=""
DOCKER_SERVICE_START=""
if [[ -n "$(command -v systemctl)" ]]; then
info "Systemd detected."
DOCKER_SERVICE_ENABLE="systemctl enable docker"
DOCKER_SERVICE_START="systemctl start docker"
elif [[ -n "$(command -v rc-update)" ]]; then
info "OpenRC detected."
DOCKER_SERVICE_ENABLE="rc-update add docker boot"
DOCKER_SERVICE_START="service docker start"
fi
if [[ -n ${DOCKER_SERVICE_ENABLE} ]]; then
info "Enabling docker service."
eval "sudo ${DOCKER_SERVICE_ENABLE}" > /dev/null 2>&1 || fatal "Failed to enable docker service.\nFailing command: ${F[C]}${DOCKER_SERVICE_ENABLE}"
info "Starting docker service."
eval "sudo ${DOCKER_SERVICE_START}" > /dev/null 2>&1 || fatal "Failed to start docker service.\nFailing command: ${F[C]}${DOCKER_SERVICE_START}"
fi
}

test_enable_docker_service() {
run_script 'require_docker'
run_script 'enable_docker_service'
}
18 changes: 0 additions & 18 deletions .scripts/enable_docker_systemd.sh

This file was deleted.

4 changes: 3 additions & 1 deletion .scripts/package_manager_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ IFS=$'\n\t'

package_manager_run() {
local ACTION=${1-}
if [[ -n "$(command -v apt-get)" ]]; then
if [[ -n "$(command -v apk)" ]]; then
run_script "pm_apk_${ACTION}"
elif [[ -n "$(command -v apt-get)" ]]; then
run_script "pm_apt_${ACTION}"
elif [[ -n "$(command -v dnf)" ]]; then
run_script "pm_dnf_${ACTION}"
Expand Down
12 changes: 12 additions & 0 deletions .scripts/pm_apk_clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -Eeuo pipefail
IFS=$'\n\t'

pm_apk_clean() {
info "apk does not require cleanup."
}

test_pm_apk_clean() {
# run_script 'pm_apk_clean'
warn "CI does not test pm_apk_clean."
}
18 changes: 18 additions & 0 deletions .scripts/pm_apk_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -Eeuo pipefail
IFS=$'\n\t'

pm_apk_install() {
notice "Installing dependencies. Please be patient, this can take a while."
local REDIRECT="> /dev/null 2>&1"
if [[ -n ${VERBOSE-} ]] || run_script 'question_prompt' "${PROMPT:-CLI}" N "Would you like to display the command output?"; then
REDIRECT=""
fi
eval "sudo apk add coreutils curl git grep newt openrc sed ${REDIRECT}" || fatal "Failed to install dependencies from apk.\nFailing command: ${F[C]}sudo apk add coreutils curl git grep newt sed"
}

test_pm_apk_install() {
# run_script 'pm_apk_repos'
# run_script 'pm_apk_install'
warn "CI does not test pm_apk_install."
}
19 changes: 19 additions & 0 deletions .scripts/pm_apk_install_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -Eeuo pipefail
IFS=$'\n\t'

pm_apk_install_docker() {
notice "Installing docker. Please be patient, this can take a while."
local REDIRECT="> /dev/null 2>&1"
if [[ -n ${VERBOSE-} ]] || run_script 'question_prompt' "${PROMPT:-CLI}" N "Would you like to display the command output?"; then
REDIRECT=""
fi
eval "sudo apk add docker docker-cli-compose ${REDIRECT}" || fatal "Failed to install docker and docker-compose using pacman.\nFailing command: ${F[C]}sudo apk add docker docker-cli-compose"

}

test_pm_apk_install_docker() {
# run_script 'pm_apk_repos'
# run_script 'pm_apk_install_docker'
warn "CI does not test pm_apk_install_docker."
}
12 changes: 12 additions & 0 deletions .scripts/pm_apk_repos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -Eeuo pipefail
IFS=$'\n\t'

pm_apk_repos() {
info "apk does not require additional repositories."
}

test_pm_apk_repos() {
# run_script 'pm_apk_repos'
warn "CI does not test pm_apk_repos."
}
19 changes: 19 additions & 0 deletions .scripts/pm_apk_upgrade.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -Eeuo pipefail
IFS=$'\n\t'

pm_apk_upgrade() {
if [[ ${CI-} != true ]]; then
notice "Upgrading packages. Please be patient, this can take a while."
local REDIRECT="> /dev/null 2>&1"
if [[ -n ${VERBOSE-} ]] || run_script 'question_prompt' "${PROMPT:-CLI}" N "Would you like to display the command output?"; then
REDIRECT=""
fi
eval "sudo apk upgrade ${REDIRECT}" || fatal "Failed to upgrade packages from apk.\nFailing command: ${F[C]}sudo apk upgrade"
fi
}

test_pm_apk_upgrade() {
# run_script 'pm_apk_upgrade'
warn "CI does not test pm_apk_upgrade."
}
1 change: 1 addition & 0 deletions .scripts/pm_dnf_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pm_dnf_install() {
}

test_pm_dnf_install() {
# run_script 'pm_dnf_repos'
# run_script 'pm_dnf_install'
warn "CI does not test pm_dnf_install."
}
1 change: 1 addition & 0 deletions .scripts/pm_dnf_install_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pm_dnf_install_docker() {
}

test_pm_dnf_install_docker() {
# run_script 'pm_dnf_repos'
# run_script 'pm_dnf_install_docker'
warn "CI does not test pm_dnf_install_docker."
}
1 change: 1 addition & 0 deletions .scripts/pm_pacman_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pm_pacman_install() {
}

test_pm_pacman_install() {
# run_script 'pm_pacman_repos'
# run_script 'pm_pacman_install'
warn "CI does not test pm_pacman_install."
}
1 change: 1 addition & 0 deletions .scripts/pm_pacman_install_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pm_pacman_install_docker() {
}

test_pm_pacman_install_docker() {
# run_script 'pm_pacman_repos'
# run_script 'pm_pacman_install_docker'
warn "CI does not test pm_pacman_install_docker."
}
1 change: 1 addition & 0 deletions .scripts/pm_yum_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pm_yum_install() {
}

test_pm_yum_install() {
# run_script 'pm_yum_repos'
# run_script 'pm_yum_install'
warn "CI does not test pm_yum_install."
}
1 change: 1 addition & 0 deletions .scripts/pm_yum_install_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pm_yum_install_docker() {
}

test_pm_yum_install_docker() {
# run_script 'pm_yum_repos'
# run_script 'pm_yum_install_docker'
warn "CI does not test pm_yum_install_docker."
}
2 changes: 1 addition & 1 deletion .scripts/run_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ run_install() {
run_script 'update_system'
run_script 'require_docker'
run_script 'setup_docker_group'
run_script 'enable_docker_systemd'
run_script 'enable_docker_service'
run_script 'request_reboot'
}

Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ You may choose to rely on DockSTARTer for various changes to your Docker system

### One Time Setup (required)

- APK Systems (Alpine)

```bash
sudo apk add curl git
bash -c "$(curl -fsSL https://get.dockstarter.com)"
sudo reboot
```

- APT Systems ([Debian](https://docs.docker.com/install/linux/docker-ce/debian/#os-requirements), [Ubuntu](https://docs.docker.com/install/linux/docker-ce/ubuntu/#os-requirements), etc)

```bash
Expand Down