Skip to content

Commit

Permalink
Cleanup dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
medihack committed Jan 1, 2025
1 parent 0297798 commit c794146
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 26 deletions.
19 changes: 9 additions & 10 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
FROM mcr.microsoft.com/devcontainers/python:3.13

# Install dependency to make bash completion work with invoke
RUN apt-get update && \
export DEBIAN_FRONTEND=noninteractive && \
apt-get install -y bash-completion && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
bash-completion \
&& rm -rf /var/lib/apt/lists/*

USER vscode

# pipx is already installed in the base devcontainers Python image
RUN pipx install invoke && \
invoke --print-completion-script=bash >> ~/.bash_completion
RUN pipx install invoke \
&& invoke --print-completion-script=bash >> ~/.bash_completion

RUN pipx install poetry && \
pipx inject poetry "poetry-dynamic-versioning[plugin]" && \
poetry completions bash >> ~/.bash_completion
RUN pipx install poetry \
&& pipx inject poetry "poetry-dynamic-versioning[plugin]" \
&& poetry completions bash >> ~/.bash_completion
47 changes: 31 additions & 16 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,42 @@
FROM gitpod/workspace-python-3.12

USER root

# Install system dependencies
# - bash-completion for shell completions of invoke
# - postgresql-common for the apt.postgresql.org.sh script
# - postgresql-client-17 for a current version of psql
RUN sudo apt-get update \
&& apt-get install -y --no-install-recommends \
bash-completion \
postgresql-common \
&& /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y \
&& apt-get install -y --no-install-recommends \
postgresql-client-17 \
&& rm -rf /var/lib/apt/lists/*

USER gitpod

ENV NVM_DIR $HOME/.nvm
ENV NODE_VERSION 20.11.0

RUN mkdir $NVM_DIR && \
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash && \
. $NVM_DIR/nvm.sh && \
nvm install $NODE_VERSION && \
nvm alias default $NODE_VERSION && \
nvm use default

RUN python3 -m pip install --user pipx && \
python3 -m pipx ensurepath && \
python3 -m pipx install invoke && \
invoke --print-completion-script=bash >> $HOME/.bash_completion

ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH

# Node is not available in in the Gitpod Python image, so we install it
RUN mkdir $NVM_DIR \
&& curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash \
&& . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default

RUN python3 -m pip install --user pipx \
&& python3 -m pipx ensurepath \
&& python3 -m pipx install invoke \
&& invoke --print-completion-script=bash >> $HOME/.bash_completion

# Poetry is already installed in the base Gitpod Python image,
# but we need to upgrade it
RUN poetry self update && \
poetry self add "poetry-dynamic-versioning[plugin]" && \
poetry completions bash >> ~/.bash_completion
RUN poetry self update \
&& poetry self add "poetry-dynamic-versioning[plugin]" \
&& poetry completions bash >> ~/.bash_completion

0 comments on commit c794146

Please sign in to comment.