https://github.com/nikoheikkila/golang-docker-api
Example project showing how to develop and package a Golang REST API with Docker.
https://github.com/nikoheikkila/golang-docker-api
docker docker-compose golang rest-api
Last synced: about 1 year ago
JSON representation
Example project showing how to develop and package a Golang REST API with Docker.
- Host: GitHub
- URL: https://github.com/nikoheikkila/golang-docker-api
- Owner: nikoheikkila
- License: mit
- Created: 2021-09-03T12:27:13.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-10-26T11:28:23.000Z (over 4 years ago)
- Last Synced: 2025-04-03T03:33:06.580Z (over 1 year ago)
- Topics: docker, docker-compose, golang, rest-api
- Language: Dockerfile
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Golang REST API + Docker Example 🐭🐳📦
This is a brief example project showing how to package a REST API application as a Docker image running a static binary.
## Usage
### Docker Compose
Build the image and launch a container.
```sh
docker-compose up --build -d
docker-compose logs -f
```
Then hit it with requests using your favourite tool and follow the log output.
```sh
curl -x GET http://localhost:3000/users | jq
```
### GitHub Codespaces
1. Open this repository in [github.com](https://github.com/nikoheikkila/golang-docker-api)
2. Press . to launch the GitHub web editor
3. From the bottom-left corner, choose _Continue working on_ and choose _Create New Codespace_
4. Wait for the build to finish, and run `make start` to start the server inside the running container, or `make build` to compile
### VS Code Dev Container
1. Open the repository in VS Code
2. From the remote containers menu in the bottom-left corner, choose _Reopen in container_
3. Repeat step #4 from above