-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.alpine
More file actions
58 lines (47 loc) · 1.18 KB
/
Copy pathDockerfile.alpine
File metadata and controls
58 lines (47 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#
# alpine-base: Base Alpine image with sudo user
#
FROM alpine:3.21 AS base
RUN apk update --quiet && \
apk add --quiet --no-cache \
bash \
curl \
gnupg \
openssh-client \
shadow \
sudo \
wget
# Create user with sudo privilege
RUN useradd -r -u 1001 --create-home -m "test-user" && \
echo "test-user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# Use bash as default shell
SHELL ["/bin/bash", "-c"]
#
# source: Base image with source copied over
#
FROM base AS source
ARG DOTFILES_DIR="/workdir/.dotfiles"
RUN mkdir -p "$DOTFILES_DIR" && \
chown -R "test-user" "$DOTFILES_DIR"
ADD --chown="test-user" home "$DOTFILES_DIR/home"
ADD --chown="test-user" install.d "$DOTFILES_DIR/install.d"
ADD --chown="test-user" script "$DOTFILES_DIR/script"
WORKDIR "$DOTFILES_DIR"
#
# install: Installation steps
#
FROM source AS install
ENV USER=test-user
ENV SKIP_SUDO_CHECK=true
ENV SKIP_SSH_CONFIG=true
ENV SKIP_DOCKER_CONFIG=true
USER test-user
ARG UUID="docker"
RUN ./script/install
#
# test: Test entrypoint
#
FROM install AS test
ADD --chown="test-user" tests "$DOTFILES_DIR/tests"
WORKDIR "$DOTFILES_DIR/tests"
ENTRYPOINT [ "./run.sh" ]