Skip to content

Commit 45334a2

Browse files
authored
Add Alpine Linux as supported platform (#19)
1 parent 7553aad commit 45334a2

File tree

5 files changed

+84
-0
lines changed

5 files changed

+84
-0
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
matrix:
1111
distribution:
1212
- almalinux-9
13+
- alpine-linux
1314
- alt-linux
1415
- amazon-linux-2
1516
- amazon-linux-2023

docker-compose.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ services:
2727
command:
2828
/native-package-installer/dockerfiles/run-test.sh
2929

30+
alpine-linux:
31+
build:
32+
context: .
33+
dockerfile: dockerfiles/alpine-linux.dockerfile
34+
volumes:
35+
- .:/native-package-installer:delegated
36+
command:
37+
/native-package-installer/dockerfiles/run-test.sh
38+
3039
alt-linux:
3140
build:
3241
context: .
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM alpine
2+
3+
RUN \
4+
apk update && apk upgrade && \
5+
apk add \
6+
bash \
7+
build-base \
8+
gcc \
9+
make \
10+
ruby \
11+
ruby-dev \
12+
openssl \
13+
openssl-dev \
14+
zlib \
15+
zlib-dev \
16+
sudo \
17+
which
18+
19+
RUN \
20+
gem install --no-user-install \
21+
bundler \
22+
rake
23+
24+
RUN \
25+
adduser native-package-installer -G wheel -D -h /home/native-package-installer
26+
27+
RUN \
28+
echo "native-package-installer ALL=(ALL:ALL) NOPASSWD:ALL" | \
29+
EDITOR=tee visudo -f /etc/sudoers.d/native-package-installer
30+
31+
USER native-package-installer
32+
WORKDIR /home/native-package-installer

lib/native-package-installer/platform.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def detect
5757

5858
require_relative "platform/suse"
5959

60+
require_relative "platform/alpine-linux"
6061

6162
# Windows
6263
require_relative "platform/msys2"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright (C) 2023 Ruby-GNOME Project Team
2+
#
3+
# This library is free software: you can redistribute it and/or modify
4+
# it under the terms of the GNU Lesser General Public License as published by
5+
# the Free Software Foundation, either version 3 of the License, or
6+
# (at your option) any later version.
7+
#
8+
# This program is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# GNU Lesser General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU Lesser General Public License
14+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
16+
class NativePackageInstaller
17+
module Platform
18+
class AlpineLinux
19+
Platform.register(self)
20+
21+
class << self
22+
def current_platform?
23+
os_release = OSRelease.new
24+
os_release.id == "alpine"
25+
end
26+
end
27+
28+
def package(spec)
29+
spec[:alpine_linux]
30+
end
31+
32+
def install_command
33+
"apk add"
34+
end
35+
36+
def need_super_user_priviledge?
37+
true
38+
end
39+
end
40+
end
41+
end

0 commit comments

Comments
 (0)