From d8adf2284e80a0abb5029a8805f4a10a5ffd3f48 Mon Sep 17 00:00:00 2001 From: Luca Prete Date: Tue, 31 Mar 2020 11:04:11 +0200 Subject: [PATCH] [#7] Add docker-compose.yml, update readme --- README.md | 35 +++++++++++++++++++++++++---------- docker-compose.yml | 12 ++++++++++++ 2 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 docker-compose.yml diff --git a/README.md b/README.md index 6aac323..f3c9da6 100644 --- a/README.md +++ b/README.md @@ -3,21 +3,23 @@ [![Join the #publiccode channel](https://img.shields.io/badge/Slack%20channel-%23publiccode-blue.svg?logo=slack)](https://developersitalia.slack.com/messages/CAM3F785T) [![Get invited](https://slack.developers.italia.it/badge.svg)](https://slack.developers.italia.it/) -This is a Go web interface validator for [publiccode.yml](https://github.com/italia/publiccode.yml) files, it uses [publiccode-parser-go](https://github.com/italia/publiccode-parser-go). +This is a Go, web interface validator for [publiccode.yml](https://github.com/italia/publiccode.yml) files, using [publiccode-parser-go](https://github.com/italia/publiccode-parser-go). publiccode.yml is an international standard for describing public software. It is expected to be published in the root of open source repositories. This parser performs syntactic and semantic validation according to the official spec. ## Features + See related project for details: [publiccode-parser-go](https://github.com/italia/publiccode-parser-go) ## Validation from command line -This repository also contains an executable tool which can be used for validating a publiccode.yml file locally. +The repository also contains a tool used to validate publiccode.yml files locally. + +```bash +go run src/main.go -```sh -$ go run src/main.go -$ curl -XPOST localhost:5000/pc/validate -d '{ +curl -XPOST localhost:5000/pc/validate -d '{ "localisation": { "localisationReady": false }, @@ -31,11 +33,24 @@ $ curl -XPOST localhost:5000/pc/validate -d '{ ``` ## Docker support -This project can be packaged and executed using Docker as follow: +The repository has a *Dockerfile*, used to also build the production image, and a *docker-compose.yml* file to facilitate the local deployment. + +To build the container, run: + +```shell +docker-compose up [-d] [--build] +``` + +where: + +* *-d* execute the containers in background + +* *--build* forces the containers build + +To destroy the container, use: -```sh -$ docker build -t pc-web-validator . -$ docker run -p5000:5000 --name pc-web-validator -it --rm pc-web-validator +```shell +docker-compose down ``` @@ -56,7 +71,7 @@ This software is maintained by the [Developers Italia](https://developers.italia ## License -© 2018-2019 Team per la Trasformazione Digitale - Presidenza del Consiglio dei Minstri +© 2018-2020 Team per la Trasformazione Digitale - Presidenza del Consiglio dei Minstri Licensed under the EUPL. The version control system provides attribution for specific lines of code. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4135d90 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3.3' + +services: + + devita_publiccode_validator: + image: italia/publiccode-validator + container_name: devita_publiccode_validator + build: + context: ./ + dockerfile: Dockerfile + ports: + - "5000:5000"