Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add action #7

Merged
merged 5 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/scripts/prepare
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
# perform minimal preparation and run ansible
export DOTFILES_USER=$USER
echo "$USER ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/$DOTFILES_USER > /dev/null
ansible-playbook $(git rev-parse --show-toplevel)/main.yml
20 changes: 20 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Docker Build Test

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build-and-run:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Build Docker image
run: docker build -t dotfiles .
- name: Run Docker container
run: docker run --rm dotfiles .github/scripts/prepare
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@ COPY . $HOME/git/dotfiles
WORKDIR $HOME/git/dotfiles
USER root
RUN chown -R ansible-user:ansible-user $HOME

# add ansible user to sudoers file for pipelines
RUN echo "ansible-user ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/ansible-user > /dev/null

USER ansible-user
RUN echo /.dockerenv
RUN git config --global --add safe.directory '*'
# RUN git checkout eerie-fog
RUN chmod +x dotfiles.sh
RUN chmod +x .github/scripts/prepare

CMD $HOME/git/dotfiles/dotfiles.sh
Loading