https://github.com/pmarques/ifconfig.me
Simple HTTP application for demos and tests
https://github.com/pmarques/ifconfig.me
demo docker go k8s-service
Last synced: 6 months ago
JSON representation
Simple HTTP application for demos and tests
- Host: GitHub
- URL: https://github.com/pmarques/ifconfig.me
- Owner: pmarques
- License: mit
- Created: 2016-11-21T01:12:09.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2026-01-12T21:06:24.000Z (6 months ago)
- Last Synced: 2026-01-13T01:46:17.081Z (6 months ago)
- Topics: demo, docker, go, k8s-service
- Language: Go
- Homepage:
- Size: 1 MB
- Stars: 39
- Watchers: 1
- Forks: 12
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# go version of ifconfig.me
[](https://github.com/pmarques/ifconfig.me/actions/workflows/docker-hub.yml)
[](https://pmarques.semaphoreci.com/projects/ifconfig.me)
[](https://circleci.com/gh/pmarques/ifconfig.me)
[](https://api.securityscorecards.dev/projects/github.com/pmarques/ifconfig.me)
This was my first project using go, a simple HTTP server that returns your public IP address.
I'm using this project for demos and learning about Docker, Go and experiment some workflows.
## Requirements
* GO >=1.9 (otherwise the steps in this readme will not work)
## Development
### Run
```
go run app/main.go
```
### Test
```
go test ./...
```
## Create binary
### Build / Compile
```
go build -o ifconfig.me app/main.go
```
### Run
```
./ifconfig.me
```
## Docker
* Build
```bash
docker build -t ifconfig.me .
```
* Run
```bash
docker run -p 8080:80 ifconfig.me
```
## Kubernetes
```
kubectl apply -f k8s
```
### Debug container
Since there is no OS or utils in the container we need to use Ephemeral Containers. For
more info check https://kubernetes.io/docs/concepts/workloads/pods/ephemeral-containers/
```
kubectl -n ifconfig debug -it ifconfig-646c744cbc-8nkfn --image=busybox --target=ifconfig
```
# References
* [Static Go Binaries](https://medium.com/@kelseyhightower/optimizing-docker-images-for-static-binaries-b5696e26eb07)
* [Multi-stage Builds](https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds)