-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (43 loc) · 1.6 KB
/
Dockerfile
File metadata and controls
57 lines (43 loc) · 1.6 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
FROM ubuntu:24.04
LABEL org.opencontainers.image.authors="Shrijal Acharya <shrijal.acharya@gmail.com>"
LABEL org.opencontainers.image.source="https://github.com/shricodev/dotfiles"
LABEL org.opencontainers.image.description="Test environment for my dotfiles configuration"
LABEL org.opencontainers.image.title="Dotfiles Test Environment"
ARG USER=shricodev
ARG group=shricodev
ARG uid=1001
ENV DEBIAN_FRONTEND=noninteractive
USER root
RUN apt-get update -y && \
apt-get upgrade -y
RUN apt-get install -y \
sudo \
curl \
git-core \
gnupg \
locales \
tzdata \
wget \
software-properties-common && \
apt-get autoremove -y
# Install Ansible
RUN add-apt-repository --yes --update ppa:ansible/ansible && \
apt-get install -y ansible
RUN adduser --quiet --disabled-password \
--shell $(which bash) --home /home/${USER} \
--uid ${uid} --gecos "Dotfiles tester" ${USER}
RUN mkdir -p /etc/sudoers.d && \
touch /etc/sudoers.d/${USER} && \
echo "%${group} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/${USER} && \
groupadd docker && \
usermod -aG docker ${USER}
RUN chown -R ${USER}:${group} /home/${USER}
USER ${USER}
RUN mkdir -p /home/${USER}/.local/bin
RUN echo 'export PATH="$HOME/.local/bin:$PATH"' >> /home/${USER}/.bashrc
# Clone the dotfiles repo from GitHub
RUN git clone --branch main https://github.com/shricodev/dotfiles.git /home/${USER}/.dotfiles
# Run ansible playbook directly. Not using --ask-become-pass since the sudoers
# config already grants NOPASSWD access and Docker builds are non-interactive.
WORKDIR /home/${USER}/.dotfiles/ansible
RUN ansible-playbook main.yml --limit local