mirror of
https://github.com/starr-dusT/dotfiles.git
synced 2025-02-18 18:57:32 -08:00
Update Dockerfile template
This commit is contained in:
parent
9e033f4df1
commit
f0bdc07a13
@ -1,58 +1,49 @@
|
|||||||
FROM fedora:latest
|
# https://github.com/starr-dusT/dotfiles
|
||||||
|
# Usage: docker build -t <image name> .
|
||||||
|
# docker run -d --name <image name> -p 8080:8080 -v .:/root/src -it <container name>
|
||||||
|
|
||||||
ENV TERM xterm-256color
|
ARG VARIANT="3.18.3"
|
||||||
|
|
||||||
###############################################################################
|
# Pull alpine container from IronBank (See readme to setup pulling from IronBank with Docker)
|
||||||
# install
|
FROM "alpine:latest"
|
||||||
###############################################################################
|
#FROM "registry1.dso.mil/ironbank/opensource/alpinelinux/alpine:${VARIANT}"
|
||||||
|
|
||||||
# base
|
##### BASE CONFIG #####
|
||||||
RUN dnf install -y \
|
|
||||||
git \
|
# Install edge repo
|
||||||
git-lfs \
|
RUN echo https://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories
|
||||||
python \
|
RUN apk --no-check-certificate update
|
||||||
python3 \
|
|
||||||
python3-pip \
|
|
||||||
python3-tornado \
|
|
||||||
cargo \
|
|
||||||
npm \
|
|
||||||
gcc \
|
|
||||||
gcc-c++ \
|
|
||||||
make \
|
|
||||||
openssl-devel \
|
|
||||||
libffi-devel \
|
|
||||||
redhat-rpm-config \
|
|
||||||
vim \
|
|
||||||
tmux \
|
|
||||||
hostname \
|
|
||||||
&& dnf clean all
|
|
||||||
|
|
||||||
# user
|
# Install Alpine packages for python
|
||||||
RUN dnf install -y \
|
RUN apk add --no-check-certificate --virtual .base-python \
|
||||||
neovim
|
python3 py3-pip ipython py3-matplotlib py3-psutil jupyter-notebook py3-tornado
|
||||||
|
|
||||||
###############################################################################
|
# Install Alpine build dependices for pip installs
|
||||||
# general
|
RUN apk add --no-check-certificate --virtual .build-deps \
|
||||||
###############################################################################
|
alpine-sdk cmake gfortran openblas-dev hdf5-dev \
|
||||||
|
python3-dev py3-numpy-dev jpeg-dev py3-qt5
|
||||||
|
|
||||||
# add user
|
# Install pip packages for python
|
||||||
RUN useradd -u 1000 -g 100 -ms /bin/bash dev \
|
RUN pip install \
|
||||||
&& echo 'dev:pass' | chpasswd
|
--break-system-packages --trusted-host pypi.org --trusted-host files.pythonhosted.org \
|
||||||
RUN usermod -aG wheel dev
|
ipykernel ipympl pandas numpy
|
||||||
|
|
||||||
###############################################################################
|
# Install other useful packages
|
||||||
# user config
|
RUN apk add --no-check-certificate --virtual .useful-packs \
|
||||||
###############################################################################
|
bash tmux git stow openssh vim nano
|
||||||
|
|
||||||
USER dev
|
##### PERSONAL CONFIG #####
|
||||||
WORKDIR /home/dev
|
|
||||||
|
|
||||||
RUN git clone --depth 1 https://github.com/wbthomason/packer.nvim \
|
|
||||||
~/.local/share/nvim/site/pack/packer/start/packer.nvim
|
|
||||||
|
|
||||||
# clone dotfiles
|
# clone dotfiles
|
||||||
RUN sh -c "$(curl -fsLS get.chezmoi.io)"
|
RUN sh -c "$(curl -fsLS get.chezmoi.io)"
|
||||||
ENV PATH="/home/dev/bin:${PATH}"
|
ENV PATH="/home/dev/bin:${PATH}"
|
||||||
RUN chezmoi init --apply https://github.com/starr-dusT/dotfiles
|
RUN chezmoi init --apply https://github.com/starr-dusT/dotfiles
|
||||||
|
|
||||||
|
# Install other useful packages
|
||||||
|
RUN apk add --no-check-certificate --virtual .user-packs \
|
||||||
|
neovim cargo npm go
|
||||||
|
# Install plugins in image
|
||||||
|
RUN nvim --headless "+Lazy! sync" +qa
|
||||||
|
|
||||||
|
WORKDIR /root
|
||||||
CMD ["/bin/bash"]
|
CMD ["/bin/bash"]
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# https://github.com/starr-dusT/dotfiles
|
|
||||||
|
|
||||||
image_name="<image name>"
|
|
||||||
container_name="<container name>"
|
|
||||||
|
|
||||||
# if container image doesn't exist build it
|
|
||||||
if [ "$(docker images -q $image_name)" ]; then
|
|
||||||
echo "Image exists don't need to build..."
|
|
||||||
else
|
|
||||||
docker run -t "$image_name" .
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if container doesn't exist run it else start/attach
|
|
||||||
if [ "$(docker ps -a --filter "status=exited" --format "{{.Names}}" -f name=$container_name)" ]; then
|
|
||||||
echo "Attaching to existing container..."
|
|
||||||
docker start "$container_name"
|
|
||||||
docker attach "$container_name"
|
|
||||||
else
|
|
||||||
echo "Running new container..."
|
|
||||||
docker run --name "$container_name" --network host -v ./:/home/dev/src -it "$image_name"
|
|
||||||
fi
|
|
Loading…
x
Reference in New Issue
Block a user