File tree Expand file tree Collapse file tree 3 files changed +66
-3
lines changed
Expand file tree Collapse file tree 3 files changed +66
-3
lines changed Original file line number Diff line number Diff line change 55 tests :
66 name : Run test suite
77 runs-on : ubuntu-latest
8+ strategy :
9+ fail-fast : false
10+ matrix :
11+ dockerfile : [Dockerfile, Dockerfile.arch]
812 steps :
9131014
1115 # Run the tests
12- - name : ' Run tests'
16+ - name : Run tests (${{ matrix.dockerfile }})
17+ env :
18+ DOCKERFILE : ${{ matrix.dockerfile }}
1319 run : ./script/test
Original file line number Diff line number Diff line change 1+ #
2+ # arch-base: Base Arch image with sudo user
3+ #
4+ FROM archlinux:base AS base
5+
6+ # Install required packages
7+ RUN pacman -Sy --noconfirm && \
8+ pacman -S --noconfirm --needed \
9+ base-devel \
10+ sudo \
11+ curl \
12+ gnupg \
13+ openssh \
14+ wget && \
15+ pacman -Scc --noconfirm
16+
17+ # Create user with sudo privilege
18+ RUN useradd -r -u 1001 --create-home -m "test-user" && \
19+ echo "test-user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
20+
21+ #
22+ # source: Base image with source copied over
23+ #
24+ FROM base AS source
25+
26+ ARG DOTFILES_DIR="/workdir/.dotfiles"
27+ RUN mkdir -p "$DOTFILES_DIR" && \
28+ chown -R "test-user" "$DOTFILES_DIR"
29+
30+ ADD --chown="test-user" files "$DOTFILES_DIR/files"
31+ ADD --chown="test-user" script "$DOTFILES_DIR/script"
32+ WORKDIR "$DOTFILES_DIR"
33+
34+ #
35+ # install: Installation steps
36+ #
37+ FROM source AS install
38+
39+ ENV USER=test-user
40+ ENV SKIP_SUDO_CHECK=true
41+ ENV SKIP_SSH_CONFIG=true
42+ ENV SKIP_DOCKER_CONFIG=true
43+
44+ USER test-user
45+ ARG UUID="docker"
46+ RUN ./script/install
47+
48+ #
49+ # test: Test entrypoint
50+ #
51+ FROM install AS test
52+
53+ ADD --chown="test-user" tests "$DOTFILES_DIR/tests"
54+ WORKDIR "$DOTFILES_DIR/tests"
55+ ENTRYPOINT [ "./run.sh" ]
Original file line number Diff line number Diff line change @@ -7,20 +7,22 @@ set -euo pipefail
77#
88
99IMAGE=${IMAGE:- " andrejusk/dotfiles" }
10+ DOCKERFILE=${DOCKERFILE:- Dockerfile}
1011uuid=$(
1112 uuidgen 2> /dev/null \
1213 || cat /proc/sys/kernel/random/uuid 2> /dev/null \
1314 || echo $RANDOM
1415)
1516tag=${TAG:- " $uuid " }
1617
17- echo " Building $IMAGE :$tag "
18+ echo " Building $IMAGE :$tag using $DOCKERFILE "
1819
1920docker build . \
2021 --build-arg UUID=$uuid \
2122 --cache-from $IMAGE \
2223 --tag $IMAGE :$tag \
23- --target test
24+ --target test \
25+ -f " $DOCKERFILE "
2426
2527docker run \
2628 -v " $( pwd) " /logs:/home/test-user/.dotfiles/logs \
You can’t perform that action at this time.
0 commit comments