diff --git a/.github/img/docker-logo.webp b/.github/img/docker-logo.webp new file mode 100644 index 0000000..76590b4 Binary files /dev/null and b/.github/img/docker-logo.webp differ diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..2349709 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,27 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_TOKEN_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN_PASS }} + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: d0ckmg/miniwikipedia:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e9377f6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM node:20.3 + +EXPOSE 3000 +ENV NODE_ENV=production +WORKDIR /usr/src/app + +COPY package*.json ./ + +RUN npm install --production +RUN npm ci --omit=dev + +COPY . . + +RUN npm run build + +CMD [ "node", "dist/index.js"] \ No newline at end of file diff --git a/README.md b/README.md index e975107..677b181 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ miniWikipedia is a website that lets you search every article on Wikipedia and gives you the concise summaries of any topic. It runs in Node.js and TypeScript. -## Installation +## Manual Installation To run miniWikipedia locally, you need to have Node.js and npm installed on your machine. You also need to get an API key from Wikipedia to access their data. Follow these steps to set up the project: @@ -13,6 +13,26 @@ To run miniWikipedia locally, you need to have Node.js and npm installed on your 5. Run the server: `node dist/index.js` 6. Open your browser and go to `http://localhost:3000` to see the website +## Docker Installation + + +It's possible to install the docker image of miniWikipedia by running this command: + +`docker container run -p YOUR_PORT:3000 -d d0ckmg/miniwikipedia` + +or alternatively, you can use a docker-compose file: + +**docker-compose.yml** + +```yaml +version: "3.9" +services: + node: + image: d0ckmg/miniwikipedia + container_name: miniwikipedia + ports: + - 3000:3000/tcp +``` ## Usage To use miniWikipedia, simply type a topic in the search box and click the search button or press 'enter'. While typing, below the input bar, will appear a text suggestion, to select it just click on it or press 'tab'. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..20c49e5 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +version: "3.9" +services: + node: + image: d0ckmg/miniwikipedia + container_name: miniwikipedia + ports: + - 3000:3000/tcp \ No newline at end of file