diff --git a/.Dockerignore b/.Dockerignore new file mode 100644 index 0000000..89a9194 --- /dev/null +++ b/.Dockerignore @@ -0,0 +1,7 @@ +api-docs +.github +database +programming_language_extensions.json +AUTHORS +CODE_OF_CONDUCT.md +prototype \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index a87c39f..59b670b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,18 @@ +# Use a slim Perl image to reduce layer size FROM perl:latest -WORKDIR /srv/TheWeeklyChallenge + +# Create a working directory for the application +WORKDIR /app + +# Copy the application code from the context COPY . . -RUN cpanm --installdeps --notest --with-feature=accelerate . + +# Install dependencies using cpanm +RUN cpanm --installdeps --notest --with-feature=accelerate +RUN cpanm Dancer2 Plack --force + +# Expose the port where the application will listen EXPOSE 4000 -CMD plackup -p 4000 bin/app.psgi + +# Start the application using plackup +CMD ["plackup", "-p", "4000", "bin/app.psgi"] diff --git a/README.md b/README.md index eca0126..ce4a8de 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,27 @@ This project is a fun and welcoming space for developers of all skill levels to git clone https://github.com/ChallengeForge/TheWeeklyChallenge.git ``` -- ## Run the Development Server +- ## Running the Development Server + +To ease development processes, we are using `Docker` to effortlessly build and run the backend code for this project. Follow these straightforward steps to start the development server: + +1. **Navigate to the root directory of the project** + ```bash + $ cd TheWeeklyChallenge + ``` + +2. **Build the Docker image** + ```bash + $ docker build -t pwc . + ``` + +3. **Run the Docker image on your local machine** + ```bash + $ docker run -t pwc + ``` + +4. **All set**! The development server should now be accessible at [http://127.0.0.1:4000](http://127.0.0.1:4000). + # Contribution