Skip to content

Commit

Permalink
feat: ✨ add apk for alpine support
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Nemchik <[email protected]>
  • Loading branch information
nemchik committed Sep 20, 2023
1 parent 9d7be65 commit a7ae7d1
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 1 deletion.
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
11 changes: 11 additions & 0 deletions .scripts/pm_apk_clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/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'
}
17 changes: 17 additions & 0 deletions .scripts/pm_apk_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/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 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'
}
18 changes: 18 additions & 0 deletions .scripts/pm_apk_install_docker.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_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'
}
11 changes: 11 additions & 0 deletions .scripts/pm_apk_repos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/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'
}
18 changes: 18 additions & 0 deletions .scripts/pm_apk_upgrade.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_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'
}
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

0 comments on commit a7ae7d1

Please sign in to comment.