61 lines
1.9 KiB
Docker
Executable File
61 lines
1.9 KiB
Docker
Executable File
FROM mcr.microsoft.com/devcontainers/base:bookworm
|
|
|
|
ARG USERNAME=vscode
|
|
|
|
# Install things I need for Caddy and such
|
|
|
|
RUN \
|
|
--mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
|
rm -f \
|
|
/etc/apt/apt.conf.d/docker-clean \
|
|
/etc/apt/apt.conf.d/docker-no-languages \
|
|
&& apt-get update -y && apt-get upgrade -y \
|
|
&& apt-get install -y --no-install-recommends \
|
|
apt-transport-https \
|
|
debian-archive-keyring \
|
|
debian-keyring \
|
|
gnupg \
|
|
postgresql-common \
|
|
pwgen
|
|
|
|
# Add Caddy repo
|
|
|
|
RUN --mount=type=bind,target=/tmp/caddy.key,source=./dockerfiles/assets/keys/caddy.key \
|
|
gpg -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg --dearmor /tmp/caddy.key
|
|
COPY ./dockerfiles/assets/apt-sources/caddy-stable.list /etc/apt/sources.list
|
|
|
|
# Add Postgresql repo
|
|
|
|
RUN /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y
|
|
|
|
RUN \
|
|
--mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
|
apt-get update -y && apt-get upgrade -y \
|
|
&& apt-get install -y --no-install-recommends \
|
|
caddy \
|
|
postgresql-client
|
|
|
|
RUN mkdir -p /workspaces/kredens && chown vscode:vscode /workspaces
|
|
WORKDIR /workspaces/kredens
|
|
|
|
# Persist history
|
|
|
|
RUN \
|
|
SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
|
|
&& mkdir /commandhistory \
|
|
&& touch /commandhistory/.bash_history \
|
|
&& chown -R $USERNAME /commandhistory \
|
|
&& echo "$SNIPPET" >> "/home/$USERNAME/.bashrc"
|
|
|
|
RUN \
|
|
mkdir -p /home/${USERNAME}/.local/bin/ \
|
|
&& chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.local/
|
|
|
|
COPY --chown=${USERNAME}:${USERNAME} \
|
|
dockerfiles/assets/scripts/onCreate.sh \
|
|
dockerfiles/assets/scripts/postAttach.sh \
|
|
/home/${USERNAME}/.local/bin/
|
|
|
|
USER ${USERNAME} |