tidy Docker/Makefiles and config.fish

This commit is contained in:
Andrejus
2020-03-02 22:21:03 +00:00
parent 0d87c48e9c
commit 1c7586139f
4 changed files with 31 additions and 30 deletions

View File

@@ -4,27 +4,28 @@ from ubuntu:bionic
# (usually) Cached steps # (usually) Cached steps
# ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- #
# Set FAST_MODE to prevent git and upgrade # See bootstrap.sh
ENV FAST_MODE="true" ENV FAST_MODE="true"
ENV WORKSPACE="$HOME/workspace" ENV WORKSPACE="$HOME/workspace"
# Install sudo for compatibility, git since it is skipped, make # Set Noninteractive
# Triple quiet mode (-qq implies -y, pipe to /dev/null)
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
# Install sudo for compatibility, git since built-in is skipped, make
RUN apt-get -y update \ RUN apt-get -y update \
&& apt-get -y install sudo git make && apt-get -y install sudo git make
# Create user with sudo priviledge # Create user with sudo priviledge
ENV USER="test-user" ENV USER="test-user"
RUN useradd --create-home -m $USER \ RUN useradd --create-home -m "$USER" \
&& adduser $USER sudo && adduser "$USER" sudo
RUN echo "$USER ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers RUN echo "$USER ALL=(ALL) NOPASSWD: ALL" \
>> /etc/sudoers
# ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- #
# Filesystem copy steps # Filesystem copy steps
# ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- #
# Copy dotfiles in
ADD --chown=test-user . "$WORKSPACE/dotfiles" ADD --chown=test-user . "$WORKSPACE/dotfiles"
WORKDIR "$WORKSPACE/dotfiles" WORKDIR "$WORKSPACE/dotfiles"
@@ -32,7 +33,6 @@ WORKDIR "$WORKSPACE/dotfiles"
# Install steps # Install steps
# ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- #
# Run installer
USER test-user USER test-user
RUN make install RUN make install
@@ -40,5 +40,4 @@ RUN make install
# Test steps # Test steps
# ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- #
# Run tests CMD ["cd", "tests", "&&", "make"]
CMD ["make", "test"]

View File

@@ -5,9 +5,7 @@
.PHONY: install clean .PHONY: install clean
# Install dotfiles locally # Install dotfiles locally
install: SHELL:=/bin/bash
install: install:
chmod +x ./bootstrap.sh
./bootstrap.sh ./bootstrap.sh
# Clean up after install # Clean up after install
@@ -17,12 +15,16 @@ clean:
# ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- #
# Docker commands # Docker commands
# ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- #
.PHONY: build run .PHONY: build run use
# Build and tag latest docker image # Build and tag docker image
build: build:
docker build . -t dotfiles:latest docker build . -t dotfiles
# Run latest docker container # Run tests in docker container
run: run:
docker run -it dotfiles:latest /bin/bash docker run dotfiles
# Launch bash in docker container
use:
docker run -it dotfiles /bin/bash

View File

@@ -1,9 +1,14 @@
# Pyenv # .local
setenv PYENV_ROOT "$HOME/.pyenv" set -x PATH $HOME/.local/bin $PATH
setenv PATH "$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH"
# Poetry # pyenv
set -gx PATH $HOME/.poetry/bin $PATH set PYENV_ROOT $HOME/.pyenv
set -x PATH $PYENV_ROOT/bin $PATH
set -x PATH $PYENV_ROOT/shims $PATH
# poetry
set PYENV_ROOT $HOME/.pyenv
set -x PATH $PYENV_ROOT/bin $PATH
# Wipe greeting # Wipe greeting
set fish_greeting set fish_greeting

View File

@@ -1,11 +1,6 @@
# dotfiles tests Makefile # dotfiles tests Makefile
# ---------------------------------------------------------------------------- # all: SHELL:=/bin/bash
# Test commands all:
# ---------------------------------------------------------------------------- # source ~/.bashrc
.PHONY: test
# Import .bashrc and run test suite
test: SHELL:=/bin/bash
test:
poetry install poetry install
poetry run pytest poetry run pytest