generated from nyu-devops/project-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f9670a
commit b6630b4
Showing
1 changed file
with
10 additions
and
55 deletions.
There are no files selected for viewing
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
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 |