Created
February 24, 2024 15:45
-
-
Save 2tony2/b29e172332c2765fe560e9be01b1227c to your computer and use it in GitHub Desktop.
A example Dockerfile configuration for dbt devcontainer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################### | |
##### SETTING OPERATING SYSTEM ##### | |
################################################### | |
# This is an official python image. | |
FROM python:3.11.6-bookworm | |
# Set the user to root. | |
USER root | |
# Prevent interactive popups when initializing debian. | |
ENV DEBIAN_FRONTEND=noninteractive | |
# Set up a dir for our stuff | |
RUN mkdir -p /devcontainer | |
RUN chmod -R 777 /devcontainer | |
# Install OS packages | |
RUN apt-get update && apt-get install -y \ | |
build-essential \ | |
curl \ | |
git \ | |
cmake \ | |
wget \ | |
zsh | |
################################################### | |
##### CONFIGURING PYTHON AND INIT SCRIPTS ##### | |
################################################### | |
# Set up an installation env | |
COPY ./scripts /devcontainer/init | |
COPY ./requirements.txt /devcontainer/requirements.txt | |
# Install python packages | |
RUN pip install --upgrade pip --disable-pip-version-check | |
RUN pip install -r /init/requirements.txt --disable-pip-version-check | |
# The following will persist shell history between sessions | |
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \ | |
&& echo "$SNIPPET" >> "/root/.bashrc" | |
# This works for other shells too, the following works for ZSH. | |
RUN SNIPPET="export HISTFILE=/commandhistory/.zsh_history; setopt INC_APPEND_HISTORY" \ | |
&& echo "$SNIPPET" >> "/root/.zshrc" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment