Skip to content

Commit

Permalink
Merge pull request #815 from DonRichards/patch-1
Browse files Browse the repository at this point in the history
Addressing compatibility and remove DOCKER_BUILDKIT in the Docker setup
  • Loading branch information
mjordan authored Aug 23, 2024
2 parents 525c1c9 + b947ae5 commit 132062b
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,44 @@
FROM python:3.10.6

# Build the image and name it workbench-docker-image-name (or whatever you want)
# docker build -t workbench-docker-image-name .
# docker build --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) -t workbench-docker .

# Build the container from the built image and run workbench:
# docker run -it --rm --network="host" -v $(pwd):/workbench --name workbench-docker-container-name workbench-docker-image-name bash -lc "(./workbench --config example.yml --check)"
# docker run -it --rm --network="host" -v $(pwd)/islandora_workbench:/workbench --name workbench-docker-container-name workbench-docker-image-name bash -lc "./workbench --config /workbench/islandora_workbench_demo_content/example.yml --check"
# docker run -it --rm --network="host" -v .:/workbench --name update_existing_objects workbench-docker bash -lc "./workbench --config /workbench/prod/update_islandora_objects.yml --check"
# Another example but with mounted directories for the migration to have access to.
# docker run -it --rm --network="host" -v .:/workbench -v /path/to/your/tmp:/tmp -v /path/to/your/files:/mnt/data/local --name update_existing_objects workbench-docker bash -lc "./workbench --config /workbench/prod/update_islandora_objects.yml --check"
# To export a CSV file, that includes the available Drupal fields, run:
# docker run -it --rm --network="host" -v $(pwd)/islandora_workbench:/workbench --name workbench-docker-container-name workbench-docker-image-name bash -lc "./workbench --config /workbench/islandora_workbench_demo_content/idc_example_geo.yml --get_csv_template"
# docker run -it --rm --network="host" -v .:/workbench --name workbench-docker-container-name workbench-docker-image-name bash -lc "./workbench --config /workbench/islandora_workbench_demo_content/idc_example_geo.yml --get_csv_template"
# The directory this file is in is mounted within the container at /workbench
# Rename example.yml to your YML file.

ADD . /workbench/
# Create a non-root user and set up the environment
ARG USER_ID
ARG GROUP_ID

# Create a group with the specified GID
RUN groupadd -g $GROUP_ID dockeruser || true

# Create a user with the specified UID and GID
RUN useradd -m -u $USER_ID -g $GROUP_ID -s /bin/bash dockeruser

# Set the working directory
WORKDIR /workbench

# Works with and without this line
RUN python -m pip install setuptools libmagic urllib3>=1.21.1
# Copy the current directory contents into the container at /workbench
COPY . /workbench/

# Set ownership and permissions for the non-root user
RUN chown -R dockeruser:dockeruser /workbench

# Set the PATH environment variable to include .local/bin
ENV PATH=/home/dockeruser/.local/bin:$PATH

# Switch to the non-root user
USER dockeruser

RUN python setup.py install
# Install dependencies and setup the environment
RUN python -m pip install --user --upgrade pip setuptools build && \
python -m pip install --user --no-cache-dir "urllib3>=1.21.1" libmagic && \
python -m build && \
python -m pip install --user dist/*.whl

0 comments on commit 132062b

Please sign in to comment.