From b6630b4b8d156abc04bd44e77c95075ed69f7214 Mon Sep 17 00:00:00 2001 From: ritikamotwani Date: Wed, 1 May 2024 17:46:22 -0400 Subject: [PATCH] Fix the dockerfile --- .devcontainer/Dockerfile | 65 +++++++--------------------------------- 1 file changed, 10 insertions(+), 55 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index c15e212..d0f0909 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,63 +1,18 @@ -# # This image has selenium and chrome driver already installed -# FROM rofrano/pipeline-selenium:latest +# This image has selenium and chrome driver already installed +FROM rofrano/pipeline-selenium:latest -# # Become a regular user for development -# ARG USERNAME=vscode -# USER $USERNAME - -# # Install user mode tools -# COPY .devcontainer/scripts/install-tools.sh /tmp/ -# RUN cd /tmp; bash ./install-tools.sh - -# # Set up the Python development environment -# WORKDIR /app -# COPY pyproject.toml poetry.lock ./ -# RUN sudo python -m pip install --upgrade pip poetry && \ -# sudo poetry config virtualenvs.create false && \ -# sudo poetry install && \ -# sudo poetry lock --no-update - -# Image for a Python 3 development environment -FROM python:3.11-slim - -# Add any tools that are needed beyond Python 3.11 -RUN apt-get update && \ - apt-get install -y sudo vim make git zip tree curl wget jq procps net-tools build-dep python-psycopg2 libpq-dev && \ - apt-get autoremove -y && \ - apt-get clean -y - -RUN sudo python -m pip install psycopg2 psycopg2-binary - -# Create a user for development +# Become a regular user for development ARG USERNAME=vscode -ARG USER_UID=1000 -ARG USER_GID=$USER_UID +USER $USERNAME -# Create the user with passwordless sudo privileges -RUN groupadd --gid $USER_GID $USERNAME \ - && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -s /bin/bash \ - && usermod -aG sudo $USERNAME \ - && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ - && chmod 0440 /etc/sudoers.d/$USERNAME \ - && chown -R $USERNAME:$USERNAME /home/$USERNAME +# Install user mode tools +COPY .devcontainer/scripts/install-tools.sh /tmp/ +RUN cd /tmp; bash ./install-tools.sh # Set up the Python development environment WORKDIR /app COPY pyproject.toml poetry.lock ./ -RUN sudo python -m pip install --upgrade pip poetry && \ +RUN sudo python -m pip install -U pip poetry && \ sudo poetry config virtualenvs.create false && \ - sudo poetry install - -ENV PORT 8080 -EXPOSE $PORT - -# Enable color terminal for docker exec bash -ENV TERM=xterm-256color - -# Become a regular user for development -USER $USERNAME - -# Install user mode tools -COPY .devcontainer/scripts/install-tools.sh /tmp/ -RUN cd /tmp && bash ./install-tools.sh - + sudo poetry lock && \ + sudo poetry install \ No newline at end of file