4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

FaaS: Oracle Functions のFnクライアント環境を構成してみてみた

Last updated at Posted at 2019-12-01

Function(関数)プログラムコードをサーバー管理不要なサーバレスコンピューティングで実行できるAWS Lambda, Google Cloud Functions等のFaaS(Function as a Service)は、
Oracle Cloudにも同様のサービス「Oracle Functions」と、それをイベントドリブンで呼び出せるイベントサービスの「Oracle Cloud Infrastructure Events」があります。
Oracle Functionsは、Fn Project CLIを使用してファンクションをOracle Functionsにデプロイすると、そのファンクションはDockerイメージとして構築され、指定したDockerレジストリにプッシュされます。
今回は、Oracle Functions開発用のクライアント環境の構成、ファンクションの作成およびデプロイを行います。

■ 手順

●使用環境とOCID

次の環境でOracle Functionsを設定します

・OCI APIユーザー情報
	User名:poc@oracle.com
	User OCID:ocid1.user.oc1..aaaaaaaab______z
	
・Tenancy 情報
	Tenancy名:poc_tenancy
	Tenancy OCID: ocid1.tenancy.oc1..aaaaaaaac______x

・Compartments情報
	Compartment名:poc
	Compartment OCID: ocid1.compartment.oc1..aaaaaaaad______y

・Region情報
	リージョン名: ap-tokyo-01
	リージョン・コード: nrt

●1. Oracle Functionsで使用するOracle Cloud Infrastructure API署名キーの設定

Oracle Cloud Infrastructure API署名キーを設定します
手順は次の項目のCLI設定手順に含まれています

●2. Oracle Cloud Infrastructure CLI構成ファイルでプロファイルを作成

次を参考にCLIを設定し,稼働することを確認します
Oracle Cloud : コマンド・ライン・インタフェース(CLI) をインストールしてみた

①CLI Vresion確認

[opc@tokyo-inst01 ~]$ oci -v
    2.6.1

②CLI働確認
次のociコマンドを実行しcliが設定されていることを確認

[opc@tokyo-inst01 ~]$ oci iam region list --output table
  +-----+----------------+
  | key | name           |
  +-----+----------------+
  | BOM | ap-mumbai-1    |
  | FRA | eu-frankfurt-1 |
  | GRU | sa-saopaulo-1  |
  | IAD | us-ashburn-1   |
  | ICN | ap-seoul-1     |
  | LHR | uk-london-1    |
  | NRT | ap-tokyo-1     |
  | PHX | us-phoenix-1   |
  | SYD | ap-sydney-1    |
  | YYZ | ca-toronto-1   |
  | ZRH | eu-zurich-1    |
  +-----+----------------+

●3. oci-curlのコピーの作成および構成

Oracleが提供するベース・スクリプト(一般的にoci-curlと呼ばれる)を使用してファンクションを起動できます
oci-curlスクリプトでは、スクリプト本文に指定した資格証明に基づいて、署名付きのリクエストが作成されます

①oci-curl.sh表示
ブラウザでhttps://docs.cloud.oracle.com/iaas/Content/Resources/Assets/signing_sample_bash.txtに移動すると、oci-curlコードがRAWテキストとして表示されます
30_oci-curlコピー01.png

②oci-curl.sh作成
以下コマンドで表示されたコードをコピーして作成

[opc@tokyo-inst01 ~]$ mkdir ~/oci-curl
[opc@tokyo-inst01 ~]$ vi ~/oci-curl/oci-curl.sh

③oci-curl.sh編集
oci-curl.shファイルのサンプル資格証明を、ファンクションを起動するユーザー・アカウントの資格証明に置き換えます
、以下、tenancyId、authUserId、keyFingerprint、privateKeyPathをOCI CLIを設定した時に使用した値に編集します

・置き換え箇所

cat ~/oci-curl/oci-curl.sh
  ・・・
  # TODO: update these values to your own
  local tenancyId="ocid1.tenancy.oc1..aaaaaaaab______dsq";
  local authUserId="ocid1.user.oc1..aaaaaaaas______o3r";
  local keyFingerprint="20:3b:97:13:55:1c:5b:0d:d3:37:d8:50:4e:c5:3a:34";
  local privateKeyPath="/Users/someuser/.oci/oci_api_key.pem";
  ・・・

上記を以下のように自分の環境用に設定します

local tenancyId="ocid1.tenancy.oc1..aaaaaaaac______x";
local authUserId="ocid1.user.oc1..aaaaaaaab______z";
local keyFingerprint="21:69:5d:08:05:d3:99";
local privateKeyPath="/home/opc.oci/oci_api_key.pem";

④oci-curl.sh確認

[opc@tokyo-inst01 ~]$ cat ~/oci-curl/oci-curl.sh
  # Version: 1.0.2
  # Usage:
  # oci-curl <host> <method> [file-to-send-as-body] <request-target> [extra-curl-args]
  #
  # ex:
  # oci-curl iaas.us-ashburn-1.oraclecloud.com get "/20160918/instances?compartmentId=some-compartment-ocid"
  # oci-curl iaas.us-ashburn-1.oraclecloud.com post ./request.json "/20160918/vcns"

  function oci-curl {
    # TODO: update these values to your own
      local tenancyId="ocid1.tenancy.oc1..aaaaaaaac______x";
      local authUserId="ocid1.user.oc1..aaaaaaaab______z";
      local keyFingerprint="21:69:5d:08:05:d3:99";
      local privateKeyPath="/home/opc.oci/oci_api_key.pem";

      local alg=rsa-sha256
      local sigVersion="1"
      local now="$(LC_ALL=C \date -u "+%a, %d %h %Y %H:%M:%S GMT")"
      local host=$1
      local method=$2
      local extra_args
      local keyId="$tenancyId/$authUserId/$keyFingerprint"

      case $method in

          "get" | "GET")
              local target=$3
              extra_args=("${@: 4}")
              local curl_method="GET";
              local request_method="get";
              ;;

          "delete" | "DELETE")
              local target=$3
              extra_args=("${@: 4}")
              local curl_method="DELETE";
              local request_method="delete";
              ;;

          "head" | "HEAD")
              local target=$3
              extra_args=("--head" "${@: 4}")
              local curl_method="HEAD";
              local request_method="head";
              ;;

          "post" | "POST")
              local body=$3
              local target=$4
              extra_args=("${@: 5}")
              local curl_method="POST";
              local request_method="post";
              local content_sha256="$(openssl dgst -binary -sha256 < $body | openssl enc -e -base64)";
              local content_type="application/json";
              local content_length="$(wc -c < $body | xargs)";
              ;;

          "put" | "PUT")
              local body=$3
              local target=$4
              extra_args=("${@: 5}")
              local curl_method="PUT"
              local request_method="put"
              local content_sha256="$(openssl dgst -binary -sha256 < $body | openssl enc -e -base64)";
              local content_type="application/json";
              local content_length="$(wc -c < $body | xargs)";
              ;;

          *) echo "invalid method"; return;;
      esac

      # This line will url encode all special characters in the request target except "/", "?", "=", and "&", since those characters are used
      # in the request target to indicate path and query string structure. If you need to encode any of "/", "?", "=", or "&", such as when
      # used as part of a path value or query string key or value, you will need to do that yourself in the request target you pass in.
      local escaped_target="$(echo $( rawurlencode "$target" ))"

      local request_target="(request-target): $request_method $escaped_target"
      local date_header="date: $now"
      local host_header="host: $host"
      local content_sha256_header="x-content-sha256: $content_sha256"
      local content_type_header="content-type: $content_type"
      local content_length_header="content-length: $content_length"
      local signing_string="$request_target\n$date_header\n$host_header"
      local headers="(request-target) date host"
      local curl_header_args
      curl_header_args=(-H "$date_header")
      local body_arg
      body_arg=()

      if [ "$curl_method" = "PUT" -o "$curl_method" = "POST" ]; then
          signing_string="$signing_string\n$content_sha256_header\n$content_type_header\n$content_length_header"
          headers=$headers" x-content-sha256 content-type content-length"
          curl_header_args=("${curl_header_args[@]}" -H "$content_sha256_header" -H "$content_type_header" -H "$content_length_header")
          body_arg=(--data-binary @${body})
      fi

      local sig=$(printf '%b' "$signing_string" | \
                  openssl dgst -sha256 -sign $privateKeyPath | \
                  openssl enc -e -base64 | tr -d '\n')

      curl "${extra_args[@]}" "${body_arg[@]}" -X $curl_method -sS https://${host}${escaped_target} "${curl_header_args[@]}" \
          -H "Authorization: Signature version=\"$sigVersion\",keyId=\"$keyId\",algorithm=\"$alg\",headers=\"${headers}\",signature=\"$sig\""
  }

  # url encode all special characters except "/", "?", "=", and "&"
  function rawurlencode {
    local string="${1}"
    local strlen=${#string}
    local encoded=""
    local pos c o

    for (( pos=0 ; pos<strlen ; pos++ )); do
      c=${string:$pos:1}
      case "$c" in
          [-_.~a-zA-Z0-9] | "/" | "?" | "=" | "&" ) o="${c}" ;;
          * )               printf -v o '%%%02x' "'$c"
      esac
      encoded+="${o}"
    done

    echo "${encoded}"
  }

●4. Oracle Functionsで使用するDockerのインストール

Oracle Functionsを使用する前に、Fn ProjectがサポートしているバージョンのDockerを開発環境にインストールする必要があります Dockerがインストールされていない場合、またはDockerのインストール済バージョンがサポートされていない場合は、Dockerをインストールまたはアップグレードする必要があります

①Dockerインストール

[opc@tokyo-inst01 ~]$ sudo yum install docker-engine
  読み込んだプラグイン:langpacks, ulninfo
  依存性の解決をしています
  --> トランザクションの確認を実行しています
  ---> パッケージ docker-engine.x86_64 0:18.09.8.ol-1.0.4.el7 を インストール
  --> 依存性の処理をしています: runc < 1.0.0-20 のパッケージ: docker-engine-18.09.8.ol-1.0.4.el7.x86_64
  --> 依存性の処理をしています: container-selinux >= 2:2.77 のパッケージ: docker-engine-18.09.8.ol-1.0.4.el7.x86_64
  --> 依存性の処理をしています: docker-cli のパッケージ: docker-engine-18.09.8.ol-1.0.4.el7.x86_64
  --> 依存性の処理をしています: containerd のパッケージ: docker-engine-18.09.8.ol-1.0.4.el7.x86_64
  --> トランザクションの確認を実行しています
  ---> パッケージ container-selinux.noarch 2:2.77-5.el7 を インストール
  ---> パッケージ containerd.x86_64 0:1.2.0-1.0.5.el7 を インストール
  ---> パッケージ docker-cli.x86_64 0:18.09.8.ol-1.0.4.el7 を インストール
  ---> パッケージ runc.x86_64 0:1.0.0-19.rc5.git4bb1fe4.0.4.el7 を インストール
  --> 依存性の処理をしています: criu のパッケージ: runc-1.0.0-19.rc5.git4bb1fe4.0.4.el7.x86_64
  --> トランザクションの確認を実行しています
  ---> パッケージ criu.x86_64 0:3.12-2.el7 を インストール
  --> 依存性の処理をしています: libprotobuf-c.so.1(LIBPROTOBUF_C_1.0.0)(64bit) のパッケージ: criu-3.12-2.el7.x86_64
  --> 依存性の処理をしています: libprotobuf-c.so.1()(64bit) のパッケージ: criu-3.12-2.el7.x86_64
  --> 依存性の処理をしています: libnet.so.1()(64bit) のパッケージ: criu-3.12-2.el7.x86_64
  --> トランザクションの確認を実行しています
  ---> パッケージ libnet.x86_64 0:1.1.6-7.el7 を インストール
  ---> パッケージ protobuf-c.x86_64 0:1.0.2-3.el7 を インストール
  --> 依存性解決を終了しました

  依存性を解決しました

  =========================================================================================================================================================================
  Package                                  アーキテクチャー              バージョン                                               リポジトリー                       容量
  =========================================================================================================================================================================
  インストール中:
  docker-engine                            x86_64                        18.09.8.ol-1.0.4.el7                                     ol7_addons                         19 M
  依存性関連でのインストールをします:
  container-selinux                        noarch                        2:2.77-5.el7                                             ol7_addons                         37 k
  containerd                               x86_64                        1.2.0-1.0.5.el7                                          ol7_addons                         21 M
  criu                                     x86_64                        3.12-2.el7                                               ol7_latest                        452 k
  docker-cli                               x86_64                        18.09.8.ol-1.0.4.el7                                     ol7_addons                         14 M
  libnet                                   x86_64                        1.1.6-7.el7                                              ol7_latest                         57 k
  protobuf-c                               x86_64                        1.0.2-3.el7                                              ol7_latest                         27 k
  runc                                     x86_64                        1.0.0-19.rc5.git4bb1fe4.0.4.el7                          ol7_addons                        1.9 M

  トランザクションの要約
  =========================================================================================================================================================================
  インストール  1 パッケージ (+7 個の依存関係のパッケージ)

  総ダウンロード容量: 57 M
  インストール容量: 245 M
  Is this ok [y/d/N]: y
  Downloading packages:
  (1/8): container-selinux-2.77-5.el7.noarch.rpm                                                                                                    |  37 kB  00:00:00
  (2/8): containerd-1.2.0-1.0.5.el7.x86_64.rpm                                                                                                      |  21 MB  00:00:00
  (3/8): criu-3.12-2.el7.x86_64.rpm                                                                                                                 | 452 kB  00:00:00
  (4/8): docker-cli-18.09.8.ol-1.0.4.el7.x86_64.rpm                                                                                                 |  14 MB  00:00:00
  (5/8): protobuf-c-1.0.2-3.el7.x86_64.rpm                                                                                                          |  27 kB  00:00:00
  (6/8): libnet-1.1.6-7.el7.x86_64.rpm                                                                                                              |  57 kB  00:00:00
  (7/8): docker-engine-18.09.8.ol-1.0.4.el7.x86_64.rpm                                                                                              |  19 MB  00:00:00
  (8/8): runc-1.0.0-19.rc5.git4bb1fe4.0.4.el7.x86_64.rpm                                                                                            | 1.9 MB  00:00:00
  -------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  合計                                                                                                                                     180 MB/s |  57 MB  00:00:00
  Running transaction check
  Running transaction test
  Transaction test succeeded
  Running transaction
    インストール中          : 2:container-selinux-2.77-5.el7.noarch                                                                                                    1/8
    インストール中          : containerd-1.2.0-1.0.5.el7.x86_64                                                                                                        2/8
    インストール中          : libnet-1.1.6-7.el7.x86_64                                                                                                                3/8
    インストール中          : docker-cli-18.09.8.ol-1.0.4.el7.x86_64                                                                                                   4/8
    インストール中          : protobuf-c-1.0.2-3.el7.x86_64                                                                                                            5/8
    インストール中          : criu-3.12-2.el7.x86_64                                                                                                                   6/8
    インストール中          : runc-1.0.0-19.rc5.git4bb1fe4.0.4.el7.x86_64                                                                                              7/8
    インストール中          : docker-engine-18.09.8.ol-1.0.4.el7.x86_64                                                                                                8/8
  xfs_info: /var/lib is not a mounted XFS filesystem
    検証中                  : docker-engine-18.09.8.ol-1.0.4.el7.x86_64                                                                                                1/8
    検証中                  : runc-1.0.0-19.rc5.git4bb1fe4.0.4.el7.x86_64                                                                                              2/8
    検証中                  : 2:container-selinux-2.77-5.el7.noarch                                                                                                    3/8
    検証中                  : protobuf-c-1.0.2-3.el7.x86_64                                                                                                            4/8
    検証中                  : criu-3.12-2.el7.x86_64                                                                                                                   5/8
    検証中                  : docker-cli-18.09.8.ol-1.0.4.el7.x86_64                                                                                                   6/8
    検証中                  : libnet-1.1.6-7.el7.x86_64                                                                                                                7/8
    検証中                  : containerd-1.2.0-1.0.5.el7.x86_64                                                                                                        8/8

  インストール:
    docker-engine.x86_64 0:18.09.8.ol-1.0.4.el7

  依存性関連をインストールしました:
    container-selinux.noarch 2:2.77-5.el7  containerd.x86_64 0:1.2.0-1.0.5.el7  criu.x86_64 0:3.12-2.el7                       docker-cli.x86_64 0:18.09.8.ol-1.0.4.el7
    libnet.x86_64 0:1.1.6-7.el7            protobuf-c.x86_64 0:1.0.2-3.el7      runc.x86_64 0:1.0.0-19.rc5.git4bb1fe4.0.4.el7

  完了しました!

②Docker Version確認

[opc@tokyo-inst01 ~]$ docker version
  Client: Docker Engine - Community
  Version:           18.09.8-ol
  API version:       1.39
  Go version:        go1.10.8
  Git commit:        76804b7
  Built:             Fri Sep 27 21:00:18 2019
  OS/Arch:           linux/amd64
  Experimental:      false
  Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/version: dial unix /var/run/docker.sock: connect: permission denied

③Docker 起動

[opc@tokyo-inst01 ~]$ sudo systemctl start docker.service

④Docker自動起動設定

[opc@tokyo-inst01 ~]$ sudo systemctl enable docker.service
  Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

●5. Fn Project CLIインストール

Oracle Functionsを使用する前に、Fn Project CLIを開発環境にインストールする必要があります

①Fn Project CLIインストール
・Mac OSの場合

mac:~ oracle$ brew install fn
    Updating Homebrew...
    ==> Downloading https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.6.3.mavericks.bottle.tar.gz
    ######################################################################## 100.0%
    ==> Pouring portable-ruby-2.6.3.mavericks.bottle.tar.gz
    ==> Auto-updated Homebrew!
    Updated 2 taps (homebrew/core and homebrew/cask).
    ==> New Formulae
    adios2                     cups                       kind                       numpy@1.16                 ripgrep-all

    ・・・

    ==> Downloading https://homebrew.bintray.com/bottles/fn-0.5.91.mojave.bottle.tar.gz
    ==> Downloading from https://akamai.bintray.com/25/25b55ae1235af80ba5570d916de67bddb63e51ebbf5a96e3a18fc27898def186?__gda__=exp=157521
    ######################################################################## 100.0%
    ==> Pouring fn-0.5.91.mojave.bottle.tar.gz
    🍺  /usr/local/Cellar/fn/0.5.91: 5 files, 16.0MB
    ==> `brew cleanup` has not been run in 30 days, running now...
    Removing: /Users/mac/Library/Caches/Homebrew/gettext--0.20.1.mojave.bottle.tar.gz... (8.4MB)
    Removing: /Users/mac/Library/Caches/Homebrew/inetutils--1.9.4_2.mojave.bottle.tar.gz... (1MB)
    Removing: /Users/mac/Library/Caches/Homebrew/libidn--1.35.mojave.bottle.tar.gz... (380.3KB)
    Removing: /Users/mac/Library/Caches/Homebrew/libidn2--2.2.0_1.mojave.bottle.tar.gz... (224.5KB)
    Removing: /Users/mac/Library/Caches/Homebrew/wget--1.20.3_1.mojave.bottle.tar.gz... (1.4MB)
    Removing: /Users/mac/Library/Caches/Homebrew/openssl--1.0.2s.mojave.bottle.tar.gz... (3.7MB)
    Removing: /Users/mac/Library/Logs/Homebrew/wget... (64B)
    Removing: /Users/mac/Library/Logs/Homebrew/libidn2... (64B)
    Removing: /Users/mac/Library/Logs/Homebrew/gettext... (64B)
    Removing: /Users/mac/Library/Logs/Homebrew/openssl... (64B)

・Linix OSの場合

[opc@tokyo-inst01 ~]$ curl -LSs https://raw.githubusercontent.com/fnproject/cli/master/install | sh
  fn version 0.5.91

          ______
        / ____/___
        / /_  / __ \
      / __/ / / / /
      /_/   /_/ /_/`

②Fn Project CLI Version確認

[opc@tokyo-inst01 ~]$ fn version
  Client version is latest version: 0.5.91
  Server version:  ?

●6. Oracle Cloud Infrastructureに接続するFn Project CLIコンテキストの作成

①Fn Project CLIコンテキストを作成
次を入力してOracle Cloud Infrastructureの新しいFn Project CLIコンテキストを作成

・コマンド
fn create context --provider oracle
は、選択した名前

[opc@tokyo-inst01 ~]$ fn create context poc-oci-context --provider oracle
  Successfully created context: poc-oci-context

②新規コンテキストのFn Project CLI指定
Fn Project CLIで新しいコンテキストを使用することを指定

[opc@tokyo-inst01 ~]$ fn use context poc-oci-context
  Now using context: poc-oci-context

③新規コンテキストのコンパートメント構成
デプロイ済ファンクションを所有するコンパートメントのOCIDを使用して新規コンテキストを構成

・コマンド書式
fn update context oracle.compartment-id

[opc@tokyo-inst01 ~]$ fn update context oracle.compartment-id ocid1.compartment.oc1..aaaaaaaad______y
  Current context updated oracle.compartment-id with ocid1.compartment.oc1..aaaaaaaad______y

④新規コンテキストのapi-urlエンドポイント構成
次を入力してAPIをコールする際に使用するapi-urlエンドポイントを使用して、新しいコンテキストを構成
fn update context api-url
は、「Oracle Cloud Infrastructureレジストリ」リージョンのコードです たとえば、Tokyoはnrtなどです
リージョン・コードのリストは、リージョン名およびリージョン・コード別の可用性を参照

[opc@tokyo-inst01 ~]$ fn update context api-url https://functions.ap-tokyo-1.oraclecloud.com
  Current context updated api-url with https://functions.ap-tokyo-1.oraclecloud.com

⑤Oracle Functionsで使用するDockerレジストリのアドレスを指定して新しいコンテキストを構成

・コマンド
fn update context registry .ocir.io//

は、デプロイするファンクションの名前に接頭辞として付加されるリポジトリ名です

[opc@tokyo-inst01 acme-func]$ fn update context registry iad.ocir.io/ocid1.tenancy.oc1..aaaaaaaac______x/acme-repo
  Current context updated registry with nrt.ocir.io/ocid1.tenancy.oc1..aaaaaaaac______x/acme-repo

⑥Fn Project CLIコンテキスト確認
コンテキスト・ファイルを表示して、作成したFn Project CLIコンテキストを確認

[opc@tokyo-inst01 ~]$ cat ~/.fn/contexts/poc-oci-context.yaml
  api-url: https://functions.ap-tokyo-1.oraclecloud.com
  oracle.compartment-id: ocid1.compartment.oc1..aaaaaaaad______y
  provider: oracle
  registry: registry: nrt.ocir.io/ocid1.tenancy.oc1..aaaaaaaac______x/acme-repo

●7.oracle.profileパラメータを使用したFn Project CLIのコンテキストの設定

Oracle Functionsで使用するために作成したプロファイルを使用するようにFn Project CLIを構成

①Fn Project CLIコンテキスト設定

[opc@tokyo-inst01 contexts]$ fn update context oracle.profile poc-oci-profile
  Current context updated oracle.profile with poc-oci-profile

●8.「Oracle Cloud Infrastructureレジストリ」へのログインを有効化する認証トークンの生成

Oracle Functionsを使用する前に、ファンクションの作成およびデプロイに使用するユーザー・アカウントに、Oracle Cloud Infrastructure認証トークンが必要です 「Oracle Cloud Infrastructureレジストリ」にDockerをログインするときに、認証トークンをパスワードとして使用

①「ユーザー詳細」画面
コンソールの右上隅にある、「プロファイル」メニューから「ユーザー」をクリックし、
11.png

②「認証トークン」画面
ユーザー詳細」画面右側にある「認証トークン」をクリックし「トークンの生成」をクリックし、 新しい認証トークンを作成
12.png

③authトークンをコピー
1度作成するとauthトークンは再び表示されないため、すぐに安全なロケーションにコピーします
13.png

●9. Dockerの起動

ターミナル・ウィンドウで標準のhello-world Dockerイメージをコンテナとして起動し、次の情報を入力してDockerが実行されていることを確認

①Dockerアクセス・グループ付与
Dockerにアクセスするには OSグループのdockerが必要なので、OSユーザに付与します

[opc@tokyo-inst01 ~]$ sudo usermod -g docker opc
[opc@tokyo-inst01 ~]$ exit

  再ログイン

[opc@tokyo-inst01 ~]$ id -a
  uid=1000(opc) gid=992(docker) groups=992(docker),4(adm),10(wheel),190(systemd-journal) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

[opc@tokyo-inst01 ~]$ docker run hello-world

  Hello from Docker!
  This message shows that your installation appears to be working correctly.

  To generate this message, Docker took the following steps:
  1. The Docker client contacted the Docker daemon.
  2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
      (amd64)
  3. The Docker daemon created a new container from that image which runs the
      executable that produces the output you are currently reading.
  4. The Docker daemon streamed that output to the Docker client, which sent it
      to your terminal.

  To try something more ambitious, you can run an Ubuntu container with:
  $ docker run -it ubuntu bash

  Share images, automate workflows, and more with a free Docker ID:
  https://hub.docker.com/

  For more examples and ideas, visit:
  https://docs.docker.com/get-started/

●10.「Oracle Cloud Infrastructureレジストリ」へのログイン

①ターミナル・ウィンドウで、次を入力して「Oracle Cloud Infrastructureレジストリ」にログインします:

・コマンド
docker login .ocir.io

は、Fn Project CLIコンテキストで指定されたOracle Cloud Infrastructureレジストリリージョンのコードです。たとえば、東京はnrtです

・実行
Login Succeededと出力されればOKです

[opc@tokyo-inst01 ~]$ docker login nrt.ocir.io
  Username: <tenancy-namespace>/<username>
  Password: <認証トークン・パスワード>
  WARNING! Your password will be stored unencrypted in /home/opc/.docker/config.json.
  Configure a credential helper to remove this warning. See
  https://docs.docker.com/engine/reference/commandline/login/#credentials-store

  Login Succeeded

■ファンクション開発のための構成の検証

①初期構成確認
[opc@tokyo-inst01 ~]$ fn list apps
No apps found
NAME ID

アプリケーションが見つからなかったことを示すメッセージです
Oracle Functionsにテナンシが最初に構成されているときのメッセージです

②アプリケーションの作成
Oracle Functionsで、ファンクションをデプロイするための準備としてアプリケーションを作成できます
アプリケーションにファンクションを含める必要はありません
コンソール、Fn Project CLIおよびAPIを使用して、アプリケーションを作成できます
ここでは、Fn Project CLIを使用して新しいアプリケーションを作成

・コマンド
fn create app --annotation oracle.com/oci/subnetIds='[""]'

ここでは、テストとしてacmeappを作成

[opc@tokyo-inst01 ~]$ fn create app acmeapp --annotation oracle.com/oci/subnetIds='["ocid1.subnet.oc1.iad.aaaaaaaabakh7hd266pjb7hbd5u5vzntoynhpkjrguh6df2klxxbysrkdihq"]'
  Successfully created app:  acmeapp


[opc@tokyo-inst01 ~]$ fn list apps
  NAME		ID
  acmeapp		ocid1.fnapp.oc1.iad.aaaaaaaaaf_____f

■ファンクションの作成およびデプロイ

Fn Project CLIコマンドを使用してファンクションをOracle Functionsに作成およびデプロイします

①ファンクションを初期化
次を入力してファンクションを初期化
はサポートされているランタイム言語の1つです
(現在、go, java, node, pythonがサポートされています)

fn init --runtime

ここではjavaを設定します

[opc@tokyo-inst01 ~]$ fn init --runtime python acme-func
  Creating function at: ./acme-func
  Function boilerplate generated.
  func.yaml created.

[opc@tokyo-inst01 ~]$ ls
 acme-func  bin  lib  oci-curl

[opc@tokyo-inst01 acme-func]$ ls ~/acme-func/
  func.yaml  pom.xml  src

②ファンクションをOracle Functionsにデプロイ

・コマンド
fn -v deploy --app

先ほど作成したアプリケーションacmeappを使用してデプロイします

[opc@tokyo-inst01 ~]$ cd ~/acme-func
[opc@tokyo-inst01 acme-func]$ fn -v deploy --app acmeapp
  Deploying acme-func to app: acmeapp
  Bumped to version 0.0.2
  Building image acme-func:0.0.2
  FN_REGISTRY:  FN_REGISTRY is not set.
  Current Context:  poc-oci-context
  Sending build context to Docker daemon  17.92kB
  Step 1/11 : FROM fnproject/fn-java-fdk-build:jdk11-1.0.104 as build-stage
  Trying to pull repository docker.io/fnproject/fn-java-fdk-build ...
  jdk11-1.0.104: Pulling from docker.io/fnproject/fn-java-fdk-build
  8d691f585fa8: Pull complete
  3da6fe7ff2ef: Pull complete
  e22147996cc0: Pull complete
  ebc78a5f677c: Pull complete
  63bcbf297578: Pull complete
  916ea1fc4052: Pull complete
  17ea310950d3: Pull complete
  aa3678fefd8e: Pull complete
  f6e81556a4ec: Pull complete
  175ec29e39bb: Pull complete
  90853e6c9c4f: Pull complete
  8b67783e2e7f: Pull complete
  Digest: sha256:94ede463e6ab5b519fb4b732f2a38f7b96daf13a56a4ffa9ca0a54901c29d198
  Status: Downloaded newer image for fnproject/fn-java-fdk-build:jdk11-1.0.104
  ---> 72dcd80ee5ef
  Step 2/11 : WORKDIR /function
  ---> Running in 029805b3c1a7
  Removing intermediate container 029805b3c1a7
  ---> 947a3d24ee5d
  Step 3/11 : ENV MAVEN_OPTS -Dhttp.proxyHost= -Dhttp.proxyPort= -Dhttps.proxyHost= -Dhttps.proxyPort= -Dhttp.nonProxyHosts= -Dmaven.repo.local=/usr/share/maven/ref/repository
  ---> Running in e2eaac6dea9a
  Removing intermediate container e2eaac6dea9a
  ---> 2906f250b36a
  Step 4/11 : ADD pom.xml /function/pom.xml
  ---> 5b955263d6db
  Step 5/11 : RUN ["mvn", "package", "dependency:copy-dependencies", "-DincludeScope=runtime", "-DskipTests=true", "-Dmdep.prependGroupId=true", "-DoutputDirectory=target", "--fail-never"]
  ---> Running in 52c5e27e21ec
  [INFO] Scanning for projects...
  Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/3.3/maven-compiler-plugin-3.3.pom
  Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/3.3/maven-compiler-plugin-3.3.pom (11 kB at 16 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/27/maven-plugins-27.pom
  Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/27/maven-plugins-27.pom (11 kB at 125 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/26/maven-parent-26.pom
  Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/26/maven-parent-26.pom (40 kB at 263 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/3.3/maven-compiler-plugin-3.3.jar
  Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/3.3/maven-compiler-plugin-3.3.jar (46 kB at 351 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom
  Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom (5.6 kB at 81 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.jar
  Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.jar (27 kB at 263 kB/s)
  [INFO]
  [INFO] ------------------------< com.example.fn:hello >------------------------
  [INFO] Building hello 1.0.0
  [INFO] --------------------------------[ jar ]---------------------------------
  Downloading from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/api/1.0.104/api-1.0.104.pom
  Downloaded from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/api/1.0.104/api-1.0.104.pom (0 B at 0 B/s)
  Downloading from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/fdk/1.0.104/fdk-1.0.104.pom
  Downloaded from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/fdk/1.0.104/fdk-1.0.104.pom (0 B at 0 B/s)
  Downloading from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/testing-core/1.0.104/testing-core-1.0.104.pom
  Downloaded from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/testing-core/1.0.104/testing-core-1.0.104.pom (0 B at 0 B/s)
  Downloading from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/runtime/1.0.104/runtime-1.0.104.pom
  Downloaded from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/runtime/1.0.104/runtime-1.0.104.pom (0 B at 0 B/s)
  Downloading from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/testing-junit4/1.0.104/testing-junit4-1.0.104.pom
  Downloaded from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/testing-junit4/1.0.104/testing-junit4-1.0.104.pom (0 B at 0 B/s)
  Downloading from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/api/1.0.104/api-1.0.104.jar
  Downloading from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/testing-core/1.0.104/testing-core-1.0.104.jar
  Downloading from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/testing-junit4/1.0.104/testing-junit4-1.0.104.jar
  Downloading from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/runtime/1.0.104/runtime-1.0.104.jar
  Downloaded from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/api/1.0.104/api-1.0.104.jar (0 B at 0 B/s)
  Downloaded from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/testing-core/1.0.104/testing-core-1.0.104.jar (0 B at 0 B/s)
  Downloaded from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/runtime/1.0.104/runtime-1.0.104.jar (0 B at 0 B/s)
  Downloaded from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/testing-junit4/1.0.104/testing-junit4-1.0.104.jar (0 B at 0 B/s)
  [INFO]
  [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hello ---
  [INFO] Using 'UTF-8' encoding to copy filtered resources.
  [INFO] skip non existing resourceDirectory /function/src/main/resources
  [INFO]
  [INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ hello ---
  Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/reporting/maven-reporting-api/2.2.1/maven-reporting-api-2.2.1.pom
  Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/reporting/maven-reporting-api/2.2.1/maven-reporting-api-2.2.1.pom (1.9 kB at 51 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/reporting/maven-reporting/2.2.1/maven-reporting-2.2.1.pom
  Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/reporting/maven-reporting/2.2.1/maven-reporting-2.2.1.pom (1.4 kB at 32 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/doxia/doxia-sink-api/1.1/doxia-sink-api-1.1.pom
  Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/doxia/doxia-sink-api/1.1/doxia-sink-api-1.1.pom (2.0 kB at 43 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/doxia/doxia/1.1/doxia-1.1.pom
  Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/doxia/doxia/1.1/doxia-1.1.pom (15 kB at 271 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/doxia/doxia-logging-api/1.1/doxia-logging-api-1.1.pom
  Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/doxia/doxia-logging-api/1.1/doxia-logging-api-1.1.pom (1.6 kB at 83 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/commons-cli/commons-cli/1.2/commons-cli-1.2.pom
  Downloaded from central: https://repo.maven.apache.org/maven2/commons-cli/commons-cli/1.2/commons-cli-1.2.pom (8.0 kB at 235 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-parent/11/commons-parent-11.pom
  Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-parent/11/commons-parent-11.pom (25 kB at 704 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-shared-utils/0.7/maven-shared-utils-0.7.pom
  Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-shared-utils/0.7/maven-shared-utils-0.7.pom (5.0 kB at 167 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-shared-components/20/maven-shared-components-20.pom
  Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-shared-components/20/maven-shared-components-20.pom (5.1 kB at 196 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-api/2.5/plexus-compiler-api-2.5.pom
  Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-api/2.5/plexus-compiler-api-2.5.pom (865 B at 30 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler/2.5/plexus-compiler-2.5.pom
  Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler/2.5/plexus-compiler-2.5.pom (5.3 kB at 231 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-components/1.3.1/plexus-components-1.3.1.pom
  Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-components/1.3.1/plexus-components-1.3.1.pom (3.1 kB at 153 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-manager/2.5/plexus-compiler-manager-2.5.pom
  Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-manager/2.5/plexus-compiler-manager-2.5.pom (690 B at 41 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-javac/2.5/plexus-compiler-javac-2.5.pom
  Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-javac/2.5/plexus-compiler-javac-2.5.pom (769 B at 27 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compilers/2.5/plexus-compilers-2.5.pom
  Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compilers/2.5/plexus-compilers-2.5.pom (1.3 kB at 43 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-shared-utils/0.7/maven-shared-utils-0.7.jar
  Downloading from central: https://repo.maven.apache.org/maven2/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar
  Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-api/2.5/plexus-compiler-api-2.5.jar
  Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-manager/2.5/plexus-compiler-manager-2.5.jar
  Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-javac/2.5/plexus-compiler-javac-2.5.jar
  Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-manager/2.5/plexus-compiler-manager-2.5.jar (4.6 kB at 26 kB/s)
  Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-api/2.5/plexus-compiler-api-2.5.jar (25 kB at 111 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.5.5/plexus-container-default-1.5.5.jar
  Downloaded from central: https://repo.maven.apache.org/maven2/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar (32 kB at 109 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-classworlds/2.2.2/plexus-classworlds-2.2.2.jar
  Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-javac/2.5/plexus-compiler-javac-2.5.jar (19 kB at 64 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/log4j/log4j/1.2.12/log4j-1.2.12.jar
  Downloading from central: https://repo.maven.apache.org/maven2/org/apache/xbean/xbean-reflect/3.4/xbean-reflect-3.4.jar
  Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-classworlds/2.2.2/plexus-classworlds-2.2.2.jar (46 kB at 88 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar
  Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-shared-utils/0.7/maven-shared-utils-0.7.jar (170 kB at 238 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/com/google/collections/google-collections/1.0/google-collections-1.0.jar
  Downloaded from central: https://repo.maven.apache.org/maven2/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar (45 kB at 61 kB/s)
  Downloading from central: https://repo.maven.apache.org/maven2/junit/junit/3.8.2/junit-3.8.2.jar
  Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/xbean/xbean-reflect/3.4/xbean-reflect-3.4.jar (134 kB at 177 kB/s)
  Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.5.5/plexus-container-default-1.5.5.jar (217 kB at 252 kB/s)
  Downloaded from central: https://repo.maven.apache.org/maven2/junit/junit/3.8.2/junit-3.8.2.jar (121 kB at 125 kB/s)
  Downloaded from central: https://repo.maven.apache.org/maven2/log4j/log4j/1.2.12/log4j-1.2.12.jar (358 kB at 309 kB/s)
  Downloaded from central: https://repo.maven.apache.org/maven2/com/google/collections/google-collections/1.0/google-collections-1.0.jar (640 kB at 502 kB/s)
  [INFO] No sources to compile
  [INFO]
  [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ hello ---
  [INFO] Using 'UTF-8' encoding to copy filtered resources.
  [INFO] skip non existing resourceDirectory /function/src/test/resources
  [INFO]
  [INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ hello ---
  [INFO] No sources to compile
  [INFO]
  [INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ hello ---
  [INFO] Tests are skipped.
  [INFO]
  [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ hello ---
  [WARNING] JAR will be empty - no content was marked for inclusion!
  [INFO] Building jar: /function/target/hello-1.0.0.jar
  [INFO]
  [INFO] --- maven-dependency-plugin:2.8:copy-dependencies (default-cli) @ hello ---
  [INFO] Copying api-1.0.104.jar to /function/target/com.fnproject.fn.api-1.0.104.jar
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time:  9.758 s
  [INFO] Finished at: 2019-12-01T05:00:07Z
  [INFO] ------------------------------------------------------------------------
  Removing intermediate container 52c5e27e21ec
  ---> 360f25929b70
  Step 6/11 : ADD src /function/src
  ---> e13869221c6b
  Step 7/11 : RUN ["mvn", "package"]
  ---> Running in 724b200c404f
  [INFO] Scanning for projects...
  [INFO]
  [INFO] ------------------------< com.example.fn:hello >------------------------
  [INFO] Building hello 1.0.0
  [INFO] --------------------------------[ jar ]---------------------------------
  [INFO]
  [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hello ---
  [INFO] Using 'UTF-8' encoding to copy filtered resources.
  [INFO] skip non existing resourceDirectory /function/src/main/resources
  [INFO]
  [INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ hello ---
  [INFO] Changes detected - recompiling the module!
  [INFO] Compiling 1 source file to /function/target/classes
  [INFO]
  [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ hello ---
  [INFO] Using 'UTF-8' encoding to copy filtered resources.
  [INFO] skip non existing resourceDirectory /function/src/test/resources
  [INFO]
  [INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ hello ---
  [INFO] Changes detected - recompiling the module!
  [INFO] Compiling 1 source file to /function/target/test-classes
  [INFO]
  [INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ hello ---
  [INFO]
  [INFO] -------------------------------------------------------
  [INFO]  T E S T S
  [INFO] -------------------------------------------------------
  [INFO] Running com.example.fn.HelloFunctionTest
  [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.799 s - in com.example.fn.HelloFunctionTest
  [INFO]
  [INFO] Results:
  [INFO]
  [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
  [INFO]
  [INFO]
  [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ hello ---
  [INFO] Building jar: /function/target/hello-1.0.0.jar
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time:  7.056 s
  [INFO] Finished at: 2019-12-01T05:00:19Z
  [INFO] ------------------------------------------------------------------------
  Removing intermediate container 724b200c404f
  ---> ec2fb10c26a3
  Step 8/11 : FROM fnproject/fn-java-fdk:jre11-1.0.104
  Trying to pull repository docker.io/fnproject/fn-java-fdk ...
  jre11-1.0.104: Pulling from docker.io/fnproject/fn-java-fdk
  8d691f585fa8: Already exists
  3da6fe7ff2ef: Already exists
  e22147996cc0: Already exists
  8df48a2d4467: Pull complete
  12823fbe837f: Pull complete
  721c91362b66: Pull complete
  42d4f712ecad: Pull complete
  905ade9fca8a: Pull complete
  Digest: sha256:42d0c95fbe68080a360515030a6958b902debb5c57331ace8e3b903a78107337
  Status: Downloaded newer image for fnproject/fn-java-fdk:jre11-1.0.104
  ---> 928cfe6738e1
  Step 9/11 : WORKDIR /function
  ---> Running in e8268cfcaa3a
  Removing intermediate container e8268cfcaa3a
  ---> 495a85e66e46
  Step 10/11 : COPY --from=build-stage /function/target/*.jar /function/app/
  ---> 9cbf24f0722c
  Step 11/11 : CMD ["com.example.fn.HelloFunction::handleRequest"]
  ---> Running in 70a075b0cccd
  Removing intermediate container 70a075b0cccd
  ---> eca8c3ff6827
  Successfully built eca8c3ff6827
  Successfully tagged acme-func:0.0.2

  Parts:  [acme-func:0.0.2]

  Fn: image name must have a dockerhub owner or private registry. Be sure to set FN_REGISTRY env var, pass in --registry or configure your context file

  See 'fn <command> --help' for more information. Client version: 0.5.91

③イメージが「Oracle Cloud Infrastructureレジストリ」に正常にプッシュされたことを確認

・レジストリ確認
コンソールで、「開発者サービス」>「レジストリ」をクリックし、レジストリ・リージョンを選択し作成したリポジトリを選択し作成されたことを確認

・Function確認
コンソールで、「開発者サービス」>「ファンクション」をクリック
40_Function作成01.png

fn deployコマンドで指定したアプリケーションの名前をクリックし、デプロイされたことを確認
41_Function作成02.png

■参考

・マニュアル:Configuring Your Client Environment for Function Development

hotwrap

4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?