Skip to content

Commit

Permalink
Added Dockerfile to facilitate portability
Browse files Browse the repository at this point in the history
  • Loading branch information
Hossy committed Feb 20, 2024
1 parent 4fd793d commit 74dea9a
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Use Ubuntu as base image
FROM ubuntu:latest

# Set the working directory
WORKDIR /app

# Install Python 3 and pip
# Print out Python and pip versions
RUN echo "[ ] Updating package lists..." && \
apt-get update && \
echo "[ ] Installing Python 3 and pip..." && \
apt-get install -y python3 python3-pip && \
echo "[ ] Cleaning up package cache..." && \
apt-get clean && \
echo "[ ] Creating a symbolic link for Python 3..." && \
ln -s /usr/bin/python3 /usr/bin/python && \
echo "[ ] Verifying Python and pip versions..." && \
python --version && \
pip --version

# Copy requirements.txt to the root directory of the image
COPY requirements.txt /requirements.txt

# Install Python dependencies from requirements.txt
RUN python3 -m pip install -r /requirements.txt

# Create a symbolic link from /app/plex_dupefinder.py to /plex_dupefinder
RUN ln -s /app/plex_dupefinder.py /plex_dupefinder

# Define a volume for the Python application
VOLUME /app

# Define default command
CMD ["/plex_dupefinder"]
60 changes: 60 additions & 0 deletions Dockerfile_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Dockerizing the Plex Dupefinder Python Application

This guide outlines the steps for Dockerizing the Plex Dupefinder Python application using Docker.

## Folder Structure

Ensure that your project has the following folder structure:

```
plex_dupefinder/
└── app/
└── Dockerfile # (Included from git checkout)
└── ... (all contents from the git checkout)
```

- `plex_dupefinder/`: Root directory for the Plex Dupefinder project.
- `app/`: Contains all files and directories retrieved from the git checkout, including the Dockerfile.

## Setting Up the Folder Structure

Follow these steps to set up the folder structure and retrieve your Python application files:

1. Open a terminal and navigate to the desired directory for your project.
2. Run the following command to clone your repository and create the `app/` folder:
```
git clone https://github.com/Hossy/plex_dupefinder.git app
```

This command clones your repository and creates the `/app` folder containing all files and directories from the git checkout, including the Dockerfile.

## Building the Docker Image

Follow these steps to build the Docker image for your Python application:

1. Open a terminal and navigate to the root directory of your project.
2. Run the following command to build the Docker image:
```
docker build -t plex_dupefinder app
```

This command builds the Docker image named `plex_dupefinder` using the Dockerfile located in the `app/` directory.

## Running the Docker Container

Once the Docker image is built, you can run it as a Docker container using the following steps:

1. Run the following command to start a Docker container from the image:
```
docker run --rm --name plex_dupefinder -v plex_dupefinder/app:/app plex_dupefinder
```

- Replace `plex_dupefinder/app` with the absolute path to the `app/` directory on your system.

2. If running with `SKIP_OTHER_DUPES=false`, add the `-i` option to the `docker run` command:
```
docker run -i --rm --name plex_dupefinder -v plex_dupefinder/app:/app plex_dupefinder
```

The `-i` option ensures interactive mode, allowing input to be sent to the container.

0 comments on commit 74dea9a

Please sign in to comment.