Skip to content

Commit

Permalink
Fix the dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ritikamotwani committed May 1, 2024
1 parent 7f9670a commit b6630b4
Showing 1 changed file with 10 additions and 55 deletions.
65 changes: 10 additions & 55 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b6630b4

Please sign in to comment.