{"id":15788442,"url":"https://github.com/pradumnasaraf/c-plus-plus-docker","last_synced_at":"2025-05-07T08:45:40.935Z","repository":{"id":236514293,"uuid":"792759612","full_name":"Pradumnasaraf/c-plus-plus-docker","owner":"Pradumnasaraf","description":"A simple HTTP server implemented in C++ using the C++ REST SDK. This is for Docker's official C++ Language Guide.","archived":false,"fork":false,"pushed_at":"2024-06-05T17:39:10.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-04T22:01:20.022Z","etag":null,"topics":["c-plus-plus","docker","docker-compose"],"latest_commit_sha":null,"homepage":"https://docs.docker.com/language/cpp","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Pradumnasaraf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["eddiejaoude"]}},"created_at":"2024-04-27T13:54:56.000Z","updated_at":"2024-09-06T06:32:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"d68e9892-29df-4693-aea6-eb08d94f842d","html_url":"https://github.com/Pradumnasaraf/c-plus-plus-docker","commit_stats":null,"previous_names":["pradumnasaraf/c-plus-plus-docker"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pradumnasaraf%2Fc-plus-plus-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pradumnasaraf%2Fc-plus-plus-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pradumnasaraf%2Fc-plus-plus-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pradumnasaraf%2Fc-plus-plus-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pradumnasaraf","download_url":"https://codeload.github.com/Pradumnasaraf/c-plus-plus-docker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252846455,"owners_count":21813425,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-plus-plus","docker","docker-compose"],"created_at":"2024-10-04T22:00:24.353Z","updated_at":"2025-05-07T08:45:40.911Z","avatar_url":"https://github.com/Pradumnasaraf.png","language":"C++","funding_links":["https://github.com/sponsors/eddiejaoude"],"categories":[],"sub_categories":[],"readme":"A simple HTTP server implemented in C++ using the C++ REST SDK. It listens for incoming HTTP GET requests and responds with a JSON message. This is for Docker's [C++ Language Guide](https://docs.docker.com/language/cpp/).\n\n## API\n\nThe server only supports the HTTP GET method at the moment. When a GET request is received, the server responds with a JSON object:\n\n```json\n{\n    \"message\": \"OK\"\n}\n```\n\n## Running with Docker Compose\n\nBelow is the [Dockerfile](Dockerfile) for the C++ application:\n\n```Dockerfile\n# Use the official Ubuntu image as the base image\nFROM ubuntu:latest\n\n# Set the working directory in the container\nWORKDIR /app\n\n# Install necessary dependencies\nRUN apt-get update \u0026\u0026 apt-get install -y \\\n    g++ \\\n    libcpprest-dev \\\n    libboost-all-dev \\\n    libssl-dev \\\n    cmake\n\n# Copy the source code into the container\nCOPY ok_api.cpp .\n\n# Compile the C++ code\nRUN g++ -o ok_api ok_api.cpp -lcpprest -lboost_system -lboost_thread -lboost_chrono -lboost_random -lssl -lcrypto\n\n# Expose the port on which the API will listen\nEXPOSE 8080\n\n# Command to run the API when the container starts\nCMD [\"./ok_api\"]\n```\n\nTo run this application using Docker Compose, you'll need to create a `compose.yml` file.\n\nHere's the `compose.yml` file:\n\n```yaml\nservices:\n  ok-api:\n    image: ok-api\n    build:\n      context: .\n      dockerfile: Dockerfile\n    ports:\n      - \"8080:8080\"\n```\n\nTo build and run the Docker image using Docker Compose, use the following command:\n\n```bash\ndocker-compose up\n```\n\nThis will build the Docker image and then run it, mapping the container's port 8080 to port 8080 on the host machine. You can then access the API by visiting `http://localhost:8080` in your web browser.\n\n## Contributing\n\nAny feedback and contributions are welcome! Please open an issue before submitting a pull request.\n\n## License\n\n[MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpradumnasaraf%2Fc-plus-plus-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpradumnasaraf%2Fc-plus-plus-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpradumnasaraf%2Fc-plus-plus-docker/lists"}