-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.test
More file actions
27 lines (21 loc) · 777 Bytes
/
Dockerfile.test
File metadata and controls
27 lines (21 loc) · 777 Bytes
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
# Dockerfile for testing setup-new-workspace.sh in a clean Fedora environment
#
# Build and run:
# docker build -f Dockerfile.test -t dotfiles-test .
# docker run --rm -it dotfiles-test bash
# yes | sudo ./setup-new-workspace.sh
#
# Test idempotency (run twice):
# docker run --rm dotfiles-test bash -c "yes | sudo ./setup-new-workspace.sh && yes | sudo ./setup-new-workspace.sh"
FROM fedora:latest
# Install sudo for the test
RUN dnf install -y sudo
# Create a test user
RUN useradd -m -s /bin/bash testuser && \
echo "testuser ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# Copy dotfiles to test user's home
COPY . /home/testuser/git/dotfiles
RUN chown -R testuser:testuser /home/testuser/git
USER testuser
WORKDIR /home/testuser/git/dotfiles
CMD ["/bin/bash"]