Skip to content

Commit

Permalink
[#446] Add files support creating mock server
Browse files Browse the repository at this point in the history
  • Loading branch information
sanG-github committed Sep 28, 2023
1 parent 98d42ae commit 6b90e03
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .template/addons/docker/Dockerfile.mock.tt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM stoplight/prism:latest

COPY /docs /usr/src/prism/packages/cli/docs/

EXPOSE 80

CMD ["mock", "-h", "0.0.0.0", "-p", "80", "docs/openapi/openapi.yml"]
1 change: 1 addition & 0 deletions .template/addons/docker/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use_source_path __dir__

template 'Dockerfile.tt'
template 'Dockerfile.mock.tt'
template 'docker-compose.dev.yml.tt'
template 'docker-compose.test.yml.tt'
template 'docker-compose.yml.tt'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Deploy Mock Server

on:
push:
branches:
- develop

jobs:
deploy:
name: Deploy mock server
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up flyctl
uses: superfly/flyctl-actions/setup-flyctl@master

- name: Deploy to fly
run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: {{ "${{ secrets.FLY_API_TOKEN }}" }}
13 changes: 13 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
app = "api-mock-server"
primary_region = "sin"

[build]
dockerfile = "Dockerfile.mock"

[http_service]
internal_port = 80
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]
1 change: 1 addition & 0 deletions template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def apply_template!(template_root)
copy_file 'Dangerfile'
copy_file '.rubocop.yml'
copy_file '.reek.yml'
copy_file 'fly.toml'

template '.ruby-gemset.tt'
template '.ruby-version.tt', force: true
Expand Down

0 comments on commit 6b90e03

Please sign in to comment.