-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
60 lines (48 loc) · 1.22 KB
/
Dockerfile
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
59
60
#
# debian-base: Base Debian image with sudo user
#
FROM debian:bookworm-slim AS base
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -qq update
RUN apt-get -qq install --no-install-recommends \
curl \
gnupg \
gnupg2 \
openssh-client \
software-properties-common \
lsb-release \
sudo \
wget
# Create user with sudo priviledge
RUN useradd -r -u 1001 --create-home -m "test-user"
RUN echo "test-user ALL=(ALL) NOPASSWD: ALL" \
>>/etc/sudoers
#
# source: Base image with source copied over
#
FROM base AS source
ARG DOTFILES_DIR="/workdir/.dotfiles"
RUN mkdir -p "$DOTFILES_DIR"
RUN chown -R "test-user" "$DOTFILES_DIR"
ADD --chown="test-user" files "$DOTFILES_DIR/files"
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" ]