mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Renamed a bunch of images to use fnproject org. (#239)
* Renamed a bunch of images to use fnproject org. * Multi-stage build for Docker. * Added tmp vendor dirs to gitignore. * Run docker-build at beginning of test.
This commit is contained in:
committed by
Denis Makogon
parent
f90879b751
commit
f559acd7ed
@@ -16,7 +16,7 @@ A simple serverless blog API
|
||||
USERNAME=YOUR_DOCKER_HUB_USERNAME
|
||||
|
||||
# build it
|
||||
docker run --rm -v "$PWD":/go/src/github.com/funcy/hello -w /go/src/github.com/funcy/hello funcy/go:dev go build -o function
|
||||
docker run --rm -v "$PWD":/go/src/github.com/fnproject/hello -w /go/src/github.com/fnproject/hello funcy/go:dev go build -o function
|
||||
docker build -t $USERNAME/func-blog .
|
||||
```
|
||||
|
||||
|
||||
3
examples/error/.gitignore
vendored
3
examples/error/.gitignore
vendored
@@ -1,3 +0,0 @@
|
||||
bundle/
|
||||
.bundle/
|
||||
func.yaml
|
||||
@@ -1,3 +0,0 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'json', '> 1.8.2'
|
||||
@@ -1,3 +0,0 @@
|
||||
# Error Function Image
|
||||
|
||||
Raises an error.
|
||||
@@ -1 +0,0 @@
|
||||
0.0.1
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
docker build -t funcy/error .
|
||||
@@ -1,13 +0,0 @@
|
||||
require 'json'
|
||||
|
||||
payload = STDIN.read
|
||||
if payload != ""
|
||||
payload = JSON.parse(payload)
|
||||
|
||||
# payload contains checks
|
||||
if payload["input"]
|
||||
puts payload["input"]
|
||||
end
|
||||
end
|
||||
|
||||
raise "Something went terribly wrong!"
|
||||
@@ -1,5 +0,0 @@
|
||||
name: funcy/error
|
||||
version: 0.0.2
|
||||
runtime: ruby
|
||||
entrypoint: ruby func.rb
|
||||
path: /error
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -x
|
||||
|
||||
./build.sh
|
||||
|
||||
PAYLOAD='{"input": "yoooo"}'
|
||||
|
||||
# test it
|
||||
echo $PAYLOAD | docker run --rm -i -e TEST=1 username/func-error
|
||||
2
examples/sleeper/.gitignore
vendored
2
examples/sleeper/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
bundle/
|
||||
.bundle/
|
||||
@@ -1,9 +0,0 @@
|
||||
FROM funcy/ruby:dev
|
||||
|
||||
WORKDIR /function
|
||||
ADD Gemfile* /function/
|
||||
RUN bundle install
|
||||
|
||||
ADD . /function/
|
||||
|
||||
ENTRYPOINT ["ruby", "function.rb"]
|
||||
@@ -1,3 +0,0 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'json', '> 1.8.2'
|
||||
@@ -1,10 +0,0 @@
|
||||
# Sleeper Function Image
|
||||
|
||||
This function sleeps for some number of seconds that you pass in.
|
||||
|
||||
Test it with:
|
||||
|
||||
```sh
|
||||
fn build
|
||||
echo '{"sleep": 5}' | fn run
|
||||
```
|
||||
@@ -1,2 +0,0 @@
|
||||
name: username/sleeper
|
||||
version: 0.0.3
|
||||
@@ -1,16 +0,0 @@
|
||||
require 'json'
|
||||
|
||||
payload = STDIN.read
|
||||
if payload != ""
|
||||
payload = JSON.parse(payload)
|
||||
|
||||
# payload contains checks
|
||||
if payload["sleep"]
|
||||
i = payload['sleep'].to_i
|
||||
STDERR.puts "Sleeping for #{i} seconds..."
|
||||
sleep i
|
||||
puts "I'm awake!" # sending this to stdout for sync response
|
||||
end
|
||||
else
|
||||
puts "ERROR: please pass in a sleep value: {\"sleep\": 5}"
|
||||
end
|
||||
Reference in New Issue
Block a user