Skip to content

Commit

Permalink
Merge pull request #517 from gawandeabhishek/feature/dockerize-chooser
Browse files Browse the repository at this point in the history
Add Dockerfile and docker-compose.yml for the containerization of the Chooser repository.
  • Loading branch information
TimidRobot committed Apr 5, 2024
2 parents 5359920 + a06528c commit 92d49c1
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# https://hub.docker.com/_/node/
FROM node:14

WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install

EXPOSE 8080

CMD ["npm", "run", "serve"]
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,50 @@ Tasks, issues, and discussion related to the release of the new chooser are trac

## Getting Started

## Using Docker

Before proceeding, ensure you have Docker installed on your local machine. If not, download and install Docker Desktop by visiting [Docker's official website](https://www.docker.com/products/docker-desktop) and follow the installation instructions.

To deploy the Creative Commons Chooser application using Docker, follow these steps:

### Step 1: Install Docker Desktop

First, ensure you have Docker Desktop installed on your local machine. Open Docker Desktop app on your local machine and follow the installation instructions.

### Step 2: Clone the Repository

Clone the Creative Commons Chooser repository to your local machine:

```bash
git clone https://github.com/creativecommons/chooser.git
```

### Step 3: Navigate to the Project Directory

Navigate into the project directory:

```bash
cd chooser
```

### Step 4: Build and Run the Docker Container

In order to have the code up and running on your machine, build the Docker container using docker-compose:

```bash
docker-compose up
```

### Step 5: Access the Application

Once the container is running, you can access the Creative Commons Chooser application by navigating to the following URL in your web browser:

```
http://localhost:8080
```

## Manual Setup

### Prerequisite
[nodeJS](https://nodejs.org/en/blog/release/v14.17.3) version 14 or below, as the version above 14 may give error.

Expand Down
27 changes: 27 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use docker compose v2 for non swarm deployments
# https://docs.docker.com/compose/compose-file/compose-file-v2/
version: '2.4'

services:

web:
# Build configuration in Dockerfile
build: .

# Keep stdin open even if not attached
stdin_open: true

restart: on-failure

# Allocate a pseudo-TTY
tty: true

# Port mapping: Map host port 8080 to container port 8080
ports:
- '8080:8080'

volumes:
# Mount the current directory from the host to /app in the container
- '.:/app'
# Mount the /app/node_modules directory from the host
- '/app/node_modules'

0 comments on commit 92d49c1

Please sign in to comment.