chore: first post.

This commit is contained in:
James Harton 2023-08-24 19:46:35 +12:00
commit 1dd145b009
Signed by: james
GPG key ID: 90E82DAA13F624F4
7 changed files with 163 additions and 0 deletions

1
.dockerignore Normal file
View file

@ -0,0 +1 @@
.docker-build-cache

62
.drone.yml Normal file
View file

@ -0,0 +1,62 @@
kind: pipeline
type: docker
name: default
steps:
- name: retrieve build cache
image: meltwater/drone-cache
pull: true
environment:
AWS_ACCESS_KEY_ID:
from_secret: ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY:
from_secret: SECRET_ACCESS_KEY
AWS_PLUGIN_PATH_STYLE: true
settings:
restore: true
endpoint:
from_secret: S3_ENDPOINT
bucket:
from_secret: CACHE_BUCKET
region: us-east-1
path-style: true
mount: .docker-build-cache
- name: build base container
image: thegeeklab/drone-docker-buildx:24
privileged: true
settings:
username: james
password:
from_secret: REGISTRY_TOKEN
registry: code.harton.nz
repo: code.harton.nz/james/dev_container
cache_from: 'type=local\\,src=.docker-build-cache'
cache_to: 'type=local,dest=.docker-build-cache'
provenance: false
context: ./base
dockerfile: ./base/Dockerfile
tags:
- latest
platforms:
- linux/arm64
- linux/amd64
- name: store build cache
image: meltwater/drone-cache
pull: true
environment:
AWS_ACCESS_KEY_ID:
from_secret: ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY:
from_secret: SECRET_ACCESS_KEY
AWS_PLUGIN_PATH_STYLE: true
settings:
rebuild: true
endpoint:
from_secret: S3_ENDPOINT
bucket:
from_secret: CACHE_BUCKET
region: us-east-1
path-style: true
mount: .docker-build-cache

3
README.md Normal file
View file

@ -0,0 +1,3 @@
This is a Docker container I use for installing tools using ASDF in dev environments.
It has a lot of stuff in it, you probably don't need it.

66
base/Dockerfile Normal file
View file

@ -0,0 +1,66 @@
FROM ubuntu:latest
ENV DEBIAN_FRONTEND="noninteractive"
# Install basic dependencies
RUN apt-get -q -y update && \
apt-get -q -y --no-install-recommends install autoconf automake \
bash build-essential bzip2 ca-certificates curl dpkg-dev file \
g++ gcc git-core imagemagick libbz2-dev libc6-dev libdb-dev libevent-dev \
libffi-dev libgdbm-dev libglib2.0-dev libgmp-dev libjpeg-dev libkrb5-dev \
liblzma-dev libmagickcore-dev libmagickwand-dev libmaxminddb-dev \
libncurses-dev libncurses5-dev libncursesw5-dev libpng-dev libpq-dev \
libreadline-dev libsctp-dev libsqlite3-dev libssl-dev libtool libwebp-dev \
libxml2-dev libxslt-dev libyaml-dev locales make make mercurial patch python3 \
unixodbc-dev unzip wget xz-utils zlib1g-dev zsh gnupg inotify-tools less \
postgresql-client ssh direnv && apt-get -q -y clean
ARG LANG=en_NZ
RUN locale-gen $LANG.UTF-8
ENV LANG $LANG.UTF-8
ENV LANGUAGE $LANG:en
ENV LC_ALL $LANG.UTF-8
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN groupadd --gid ${USER_GID} ${USERNAME}
RUN useradd --shell /usr/bin/zsh --uid ${USER_UID} --gid ${USER_GID} -m ${USERNAME}
RUN mkdir /workspace && chown ${USERNAME}:${USERNAME} /workspace
RUN touch /entrypoint.sh && chown ${USERNAME}:${USERNAME} /entrypoint.sh
RUN mkdir -p /var/tmp/history && chown -R ${USERNAME}:${USERNAME} /var/tmp/history
RUN mkdir /storage && chown ${USERNAME}:${USERNAME} /storage
# Install starship.
RUN curl -sS https://starship.rs/install.sh > install.sh
RUN chmod 755 install.sh
RUN ./install.sh --yes
RUN rm install.sh
USER ${USERNAME}
ENV HOME=/home/${USERNAME}
WORKDIR $HOME
# Install ASDF
ARG ASDF_VERSION=0.10.2
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v${ASDF_VERSION}
# Install dotfiles.
RUN mkdir -p $HOME/.config
RUN curl -sS https://code.harton.nz/james/.config/raw/branch/main/starship.toml > $HOME/.config/starship.toml
RUN curl -sS https://code.harton.nz/james/.config/raw/branch/main/zshrc > $HOME/.zshrc
WORKDIR /workspace/
# Generate an entrypoint.sh
RUN echo '#!/bin/bash' > /entrypoint.sh && \
echo 'source ~/.asdf/asdf.sh' >> /entrypoint.sh && \
echo 'eval "$(direnv hook bash)"' >> /entrypoint.sh && \
echo 'exec "$@"' >> /entrypoint.sh && \
chmod 755 /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
CMD ["zsh"]

4
base/asdf Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
source ~/.asdf/asdf.sh
exec "$@"

21
base/asdf_install Executable file
View file

@ -0,0 +1,21 @@
#!/bin/bash
set -e
source ~/.asdf/asdf.sh
REQUIRED_PLUGINS=$(cat .tool-versions | cut -d \ -f 1)
INSTALLED_PLUGINS=$(asdf plugin list || echo "")
for PLUGIN in $REQUIRED_PLUGINS; do
if [[ $INSTALLED_PLUGINS =~ (^|[[:space:]])"$PLUGIN"($|[[:space:]]) ]]; then
echo "ASDF plugin $PLUGIN already installed"
else
echo "Installing $PLUGIN ASDF plugin..."
asdf plugin add $PLUGIN
echo " ...done"
fi
done
echo "Running ASDF install..."
asdf install
echo " ...done"

6
renovate.json Normal file
View file

@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"local>renovate/renovate"
]
}