Skip to content

Commit

Permalink
Add Alpine Linux as supported platform (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Watson1978 committed Dec 18, 2023
1 parent 7553aad commit 45334a2
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
matrix:
distribution:
- almalinux-9
- alpine-linux
- alt-linux
- amazon-linux-2
- amazon-linux-2023
Expand Down
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ services:
command:
/native-package-installer/dockerfiles/run-test.sh

alpine-linux:
build:
context: .
dockerfile: dockerfiles/alpine-linux.dockerfile
volumes:
- .:/native-package-installer:delegated
command:
/native-package-installer/dockerfiles/run-test.sh

alt-linux:
build:
context: .
Expand Down
32 changes: 32 additions & 0 deletions dockerfiles/alpine-linux.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM alpine

RUN \
apk update && apk upgrade && \
apk add \
bash \
build-base \
gcc \
make \
ruby \
ruby-dev \
openssl \
openssl-dev \
zlib \
zlib-dev \
sudo \
which

RUN \
gem install --no-user-install \
bundler \
rake

RUN \
adduser native-package-installer -G wheel -D -h /home/native-package-installer

RUN \
echo "native-package-installer ALL=(ALL:ALL) NOPASSWD:ALL" | \
EDITOR=tee visudo -f /etc/sudoers.d/native-package-installer

USER native-package-installer
WORKDIR /home/native-package-installer
1 change: 1 addition & 0 deletions lib/native-package-installer/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def detect

require_relative "platform/suse"

require_relative "platform/alpine-linux"

# Windows
require_relative "platform/msys2"
Expand Down
41 changes: 41 additions & 0 deletions lib/native-package-installer/platform/alpine-linux.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (C) 2023 Ruby-GNOME Project Team
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

class NativePackageInstaller
module Platform
class AlpineLinux
Platform.register(self)

class << self
def current_platform?
os_release = OSRelease.new
os_release.id == "alpine"
end
end

def package(spec)
spec[:alpine_linux]
end

def install_command
"apk add"
end

def need_super_user_priviledge?
true
end
end
end
end

0 comments on commit 45334a2

Please sign in to comment.