https://github.com/pradumnasaraf/deno-docker
About A simple HTTP server implemented in TypeScript uses Deno as runtime. This is for Docker's official Deno Language Guide
https://github.com/pradumnasaraf/deno-docker
deno docker docker-compose kubernetes
Last synced: about 1 month ago
JSON representation
About A simple HTTP server implemented in TypeScript uses Deno as runtime. This is for Docker's official Deno Language Guide
- Host: GitHub
- URL: https://github.com/pradumnasaraf/deno-docker
- Owner: Pradumnasaraf
- License: apache-2.0
- Created: 2025-02-13T16:15:35.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-03-22T13:52:54.000Z (7 months ago)
- Last Synced: 2025-08-29T09:23:13.750Z (about 1 month ago)
- Topics: deno, docker, docker-compose, kubernetes
- Language: TypeScript
- Homepage: https://docs.docker.com/guides/deno
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
## Deno API
A simple HTTP server build with TypeScript and Deno as a runtime to serve a simple JSON response. This is for Docker's [Deno Language Guide](https://docs.docker.com/guides/deno/).
The server only supports the HTTP GET method at the moment. When a GET request is received, the server responds with a JSON object:
```json
{
"message": "OK"
}
```## Project Structure
- **server.js** - The main application file. This file contains the main server code for the application.
- **Dockerfile** - The Dockerfile for building the application image.
- **compose.yml** - The Docker Compose file for running the application.## Setup Instructions
### Running with Docker Compose
To run the Deno server using Docker Compose, you'll need to create a Dockerfile for the server. Below is the [Dockerfile](Dockerfile) for the our server:
```Dockerfile
# Use the official Deno image
FROM denoland/deno:latest# Set the working directory
WORKDIR /app# Copy server code into the container
COPY server.ts .# Set permissions (optional but recommended for security)
USER deno# Expose port 8000
EXPOSE 8000# Run the Deno server
CMD ["run", "--allow-net", "server.ts"]
```To run this application using Docker Compose, you'll need to create a `compose.yml` file. Here's the `compose.yml` file:
```yaml
services:
server:
image: deno-server
build:
context: .
dockerfile: Dockerfile
ports:
- "8000:8000"
```To build and run the Docker image using Docker Compose, use the following command:
```bash
docker compose up
```This will build the Docker image and then run it, mapping the container's port 8000 to port 8000 on the host machine. You can then access the API by visiting `http://localhost:8000` in your web browser.
## Backlinks
For more information, check the related [use case guide](https://docs.docker.com/guides/deno).## License
This project is licensed under the [Apache 2.0 License](/LICENSE).## Contributing
Since this project is intended to support a specific use case guide, contributions are limited to bug fixes or security issues. If you have a question, feel free to open an issue!