Skip to content
Snippets Groups Projects
Verified Commit fd3ca3ab authored by Andrej Ramašeuski's avatar Andrej Ramašeuski
Browse files

Swagger spec renderer, image version from spec

parent 5a087391
Branches
No related tags found
No related merge requests found
Pipeline #6886 failed
......@@ -2,18 +2,19 @@ image: docker:20.10.9
variables:
DOCKER_TLS_CERTDIR: "/certs"
IMAGE_VER: 2.6.0
services:
- docker:20.10.9-dind
before_script:
- apk add --no-cache yq
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
build:
stage: build
script:
- VERSION=`yq '.info.version' openapi.yaml`
- docker pull $CI_REGISTRY_IMAGE:latest || true
- docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$IMAGE_VER --tag $CI_REGISTRY_IMAGE:latest .
- docker push $CI_REGISTRY_IMAGE:$IMAGE_VER
- docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$VERSION --tag $CI_REGISTRY_IMAGE:latest .
- docker push $CI_REGISTRY_IMAGE:$VERSION
- docker push $CI_REGISTRY_IMAGE:latest
......@@ -21,7 +21,8 @@ RUN cpanm \
Mojo::Pg \
Mojo::Redis \
Mojo::JWT \
Mojolicious::Plugin::OpenAPI
Mojolicious::Plugin::OpenAPI \
Mojolicious::Plugin::SwaggerUI
ADD . /opt/cf
WORKDIR /opt/cf
......
......@@ -102,13 +102,19 @@ sub startup {
}
});
$self->plugin( SwaggerUI => {
url => "/api",
title => "CF Online",
});
$self->defaults(
openapi_cors_allowed_origins => ['*']
);
# Router
my $r = $self->routes;
$r->get('/')->to(cb => sub { shift->redirect_to('/api.html');});
$r->get('/')->to(cb => sub { shift->redirect_to('/swagger-ui');});
$r->websocket('/ws')->to('Websockets#main');
}
......
openapi: 3.0.3
info:
version: "2.0"
version: "2.6.1"
title: CF Online
description: CF Online
license:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment