Giter Site home page Giter Site logo

mstroecker / zig-robotstxt Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 20 KB

Lightweight docker image for serving a disallow robots.txt file using the zig programming language.

License: MIT License

Dockerfile 11.30% Zig 87.77% C++ 0.93%
zig ziglang zig-programming-language disallow-robots docker robots

zig-robotstxt's Introduction

Zig robots.txt Docker image

Build Status Docker Pulls

This project implements a small(5.7 KB) and lightweight http-server, just serving a disallow-robots.txt file using the Zig programming language(https://ziglang.org/).

Run using docker run:

docker run -p 80:8080 mstroecker/zig-robotstxt

Kubernetes Example

Kubernetes configuration example:

apiVersion: v1
kind: Namespace
metadata:
  name: myservice
---
apiVersion: v1
kind: Service
metadata:
  name: robotstxt
  namespace: myservice
spec:
  type: LoadBalancer
  ports:
  - port: 81
    targetPort: http 
    name: http
  selector:
    app: robotstxt
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: robotstxt
  namespace: myservice
spec:
  replicas: 3
  selector:
    matchLabels:
      app: robotstxt
  template:
    metadata:
      labels:
        app: robotstxt
    spec:
      containers:
      - name: robotstxt
        image: mstroecker/zig-robotstxt
        ports:
        - containerPort: 8080
          name: http
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: robotstxt
  namespace: myservice
spec:
  rules:
    - host: localhost
      http:
        paths:
          - path: /robots.txt
            backend:
              serviceName: robotstxt
              servicePort: http

Docker Compose Example

Compose configuration example with traefik:

version: '3'
services:
  traefik:
    image: traefik:1.7
    command:
      - "--docker"
      - "--docker.watch=true"
    ports:
      - "80:80"
    labels:
      traefik.enable: 'false'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro

  robotstxt:
    image: mstroecker/zig-robotstxt
    labels:
      - "traefik.port=8080"
      - "traefik.robotstxt.frontend.rule=Host:localhost;Path:/robots.txt"

Result message:

HTTP/1.1 200 OK
Content-Length: 26

User-agent: *
Disallow: /

zig-robotstxt's People

Contributors

mstroecker avatar

Stargazers

 avatar  avatar

Watchers

 avatar

zig-robotstxt's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.