Skip to content

Commit

Permalink
in progress - missing req and bash from dir when copying / installing
Browse files Browse the repository at this point in the history
  • Loading branch information
kobebuckley committed Jun 19, 2024
1 parent 696037b commit 9d99d46
Showing 1 changed file with 38 additions and 6 deletions.
44 changes: 38 additions & 6 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ FROM mcr.microsoft.com/vscode/devcontainers/base:bullseye
# FROM mcr.microsoft.com/devcontainers/universal:2


# Install main dependencies in one step to reduce layers
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y --no-install-recommends \
libpoppler-cpp-dev \
python-is-python3 \
gdal-bin \
libgdal-dev \
imagemagick \
libmagickwand-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# [Option] Install zsh
ARG INSTALL_ZSH="true"
# [Option] Upgrade OS packages to their latest versions
Expand All @@ -16,7 +28,7 @@ ARG USE_MOBY="true"
ENV DOCKER_BUILDKIT=1

# Install needed packages and setup non-root user. Use a separate RUN statement to add your
# own dependencies. A user of "automatic" attempts to reuse an user ID if one already exists.
# own dependencies. A user of "automatic" attempts to reuse a user ID if one already exists.
ARG USERNAME=automatic
ARG USER_UID=1000
ARG USER_GID=$USER_UID
Expand All @@ -28,12 +40,32 @@ RUN apt-get update \
# Clean up
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/

# Setup the app here
# Grant sudo permissions to the user
RUN echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USERNAME} \
&& chmod 0440 /etc/sudoers.d/${USERNAME}

# Setting the ENTRYPOINT to docker-init.sh will configure non-root access
# to the Docker socket. The script will also execute CMD as needed.
ENTRYPOINT [ "/usr/local/share/docker-init.sh" ]
CMD [ "sleep", "infinity" ]
# Ensure the .devcontainer directory exists and is owned by the user
# RUN mkdir -p /workspaces/uipa/.devcontainer \
# && chown -R ${USER_UID}:${USER_GID} /workspaces/uipa

# Set working directory to the project root
WORKDIR /workspaces/uipa

# Copy requirements.txt and init_db.sh to the container
COPY requirements.txt /workspaces/uipa/
COPY data/seed/init_db.sh /workspaces/uipa/data/seed/

# Debugging: display the contents of requirements.txt
RUN echo "Displaying requirements.txt:" && cat /workspaces/uipa/requirements.txt

# Install Python dependencies
RUN pip install -r /workspaces/uipa/requirements.txt \
&& chmod +x /workspaces/uipa/data/seed/init_db.sh

ENTRYPOINT ["/bin/sh", "-c", "dockerd & while(! docker info > /dev/null 2>&1); do sleep 1; done; sudo docker-compose up -d cd /workspaces/uipa && sudo ./data/seed/init_db.sh && sudo python manage.py runserver 0.0.0.0:8000"]

# Keep the container running
CMD ["sleep", "infinity"]

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
Expand Down

0 comments on commit 9d99d46

Please sign in to comment.