Experiment
continuous-integration/drone/push Build is failing Details
continuous-integration/drone Build is passing Details

This commit is contained in:
Jack Hadrill 2022-08-24 22:05:43 +00:00
parent 98faaf413a
commit 223444490c
4 changed files with 102 additions and 1 deletions

58
.drone.yml Normal file
View File

@ -0,0 +1,58 @@
kind: pipeline
type: docker
name: build-amd64
platform:
arch: amd64
steps:
- name: push
image: plugins/docker
when:
branch:
- main
settings:
dockerfile: Dockerfile
repo: git.jacknet.io/jackhadrill/container-director
tags: amd64
username: jackhadrill
password:
from_secret: password
registry: git.jacknet.io
---
kind: pipeline
type: docker
name: build-arm64
platform:
arch: arm64
steps:
- name: push
image: plugins/docker
when:
branch:
- main
settings:
dockerfile: Dockerfile
repo: git.jacknet.io/jackhadrill/container-director
tags: arm64
username: jackhadrill
password:
from_secret: password
registry: git.jacknet.io
---
kind: pipeline
type: docker
name: manifest
depends_on:
- build-amd64
- build-arm64
steps:
- name: manifest
image: plugins/manifest
settings:
username: JackNet
password:
from_secret: password
target: git.jacknet.io/jackhadrill/container-director:latest
template: git.jacknet.io/jackhadrill/container-director:ARCH
platforms:
- linux/amd64
- linux/arm64

8
Dockerfile Normal file
View File

@ -0,0 +1,8 @@
FROM nginx:alpine
ENV LISTEN_PORT="80"
ENV CONTAINER_PREFIX="container"
ENV SPAWNER_HOST="spawner"
ENV SPANWER_PORT="80"
COPY director.conf /etc/nginx/templates/director.conf.template

View File

@ -1,2 +1,22 @@
# code-spawner # Container Director
[![Build Status](https://drone.jacknet.io/api/badges/jackhadrill/container-director/status.svg)](https://drone.jacknet.io/jackhadrill/container-director)
A tool to proxy an HTTP backend, and failover to a "container spawner" if the backend does not exist.
## Usage
```yml
version: '3'
services:
...
container-director:
image: git.jacknet.io/jackhadrill/container-director:latest
restart: always
environment:
LISTEN_PORT: 80
CONTAINER_PREFIX: "container"
SPAWNER_HOST: "spawner"
SPANWER_PORT: 80
...
```

15
director.conf Normal file
View File

@ -0,0 +1,15 @@
server {
listen ${LISTEN_PORT};
server_name _;
resolver 127.0.0.11 valid=1s;
location / {
proxy_pass http://${CONTAINER_PREFIX}$http_x_forwarded_preferred_username$uri;
error_page 502 = @spawner;
}
location @spawner {
proxy_pass http://${SPAWNER_HOST}:${SPANWER_PORT}$uri;
}
}