Skip to content

Commit

Permalink
able to copy requirements, but not init sh. Also updated devcontainer…
Browse files Browse the repository at this point in the history
… to add workspace folder as it requires it
  • Loading branch information
kobebuckley committed Jun 22, 2024
1 parent 9d99d46 commit 4950ede
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 13 deletions.
27 changes: 14 additions & 13 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Note: You can use any Debian/Ubuntu based image you want.
FROM mcr.microsoft.com/vscode/devcontainers/base:bullseye
# FROM mcr.microsoft.com/vscode/devcontainers/base:bullseye
# FROM mcr.microsoft.com/devcontainers/universal:2

FROM mcr.microsoft.com/vscode/devcontainers/base:bullseye

# Install main dependencies in one step to reduce layers
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
Expand Down Expand Up @@ -33,6 +34,8 @@ ARG USERNAME=automatic
ARG USER_UID=1000
ARG USER_GID=$USER_UID
COPY library-scripts/*.sh /tmp/library-scripts/
COPY .devcontainer/library-scripts/*.sh /tmp/library-scripts/

RUN apt-get update \
&& /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" \
# Use Docker script from script library to set things up
Expand All @@ -44,16 +47,17 @@ RUN apt-get update \
RUN echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USERNAME} \
&& chmod 0440 /etc/sudoers.d/${USERNAME}

# 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
# 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/

# COPY requirements.txt /workspaces/uipa/ worked when moved inside same dir of docker
COPY ../requirements.txt /workspaces/uipa/


# COPY init_db.sh tmp/workspaces/uipa/data/seed/
COPY ../init_db.sh /workspaces/uipa/data/seed/

# Debugging: display the contents of requirements.txt
RUN echo "Displaying requirements.txt:" && cat /workspaces/uipa/requirements.txt
Expand All @@ -62,11 +66,8 @@ RUN echo "Displaying requirements.txt:" && cat /workspaces/uipa/requirements.txt
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"]
# Set ENTRYPOINT to run docker and your initialization script
ENTRYPOINT ["/bin/sh", "-c", "dockerd & while(! docker info > /dev/null 2>&1); do sleep 1; done; cd /workspaces/uipa && ./data/seed/init_db.sh && 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 \
# && apt-get -y install --no-install-recommends <your-package-list-here>
1 change: 1 addition & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "UIPA DevBox",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspaces/uipa",
"forwardPorts": [8000, 5432, 9200],
"customizations": {
"vscode": {
Expand Down
36 changes: 36 additions & 0 deletions .devcontainer/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
django==4.2.4
Markdown==3.4.3
celery==5.2.7
django-celery-email==3.0.0
django-taggit==4.0.0
pytz==2023.3
requests==2.31.0
django-floppyforms==1.9.0
python-magic==0.4.27
python-mimeparse==1.6.0
django-configurations==2.5.1
django-storages==1.13.2
dj-database-url==2.0.0
django-contrib-comments==2.2.0
unicodecsv==0.14.1
django-tinymce==3.6.1
python-docx==0.8.11
elasticsearch==8.11.1

-e git+https://github.com/codewithaloha/froide.git@main#egg=froide

lxml==5.2.1
channels==4.0.0
django-treebeard==4.4
django-leaflet==0.29.0
django-json-widget==1.1.1
django-celery-beat==2.5.0
django-mfa3==0.11.0
psycopg[binary]==3.1.18
psycopg-binary==3.1.18
-e git+https://github.com/okfde/django-filingcabinet.git@main#egg=django-filingcabinet
oauthlib==3.2.2
django-oauth-toolkit==1.7.1
django-fsm==2.8.1
websockets==11.0.3
bleach==6.0.0

0 comments on commit 4950ede

Please sign in to comment.