Skip to content

Commit

Permalink
add docker script
Browse files Browse the repository at this point in the history
  • Loading branch information
pocketberserker committed Jun 21, 2016
1 parent c686b3b commit eb9d247
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 44 deletions.
8 changes: 8 additions & 0 deletions Dockerfile
@@ -0,0 +1,8 @@
FROM fsharp/fsharp:4.0.0.4
MAINTAINER pocketberserker

COPY ./bin/FSDN /app/FSDN

EXPOSE 8083

CMD ["mono", "/app/FSDN/FSDN.exe", "--home-directory", "/app/FSDN/"]
59 changes: 59 additions & 0 deletions Dockerfile-build
@@ -0,0 +1,59 @@
FROM fsharp/fsharp:4.0.0.4
MAINTAINER pocketberserker

# The MIT License (MIT)

# Copyright (c) 2015 Joyent, Inc.
# Copyright (c) 2015 Node.js contributors

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

# gpg keys listed at https://github.com/nodejs/node
RUN set -ex \
&& for key in \
9554F04D7259F04124DE6B476D5A82AC7E37093B \
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \
FD3A5288F042B6850C66B31F09FE44734EB7990E \
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
; do \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
done

ENV NPM_CONFIG_LOGLEVEL info
ENV NODE_VERSION 6.2.2

RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \
&& curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
&& grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
&& tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \
&& rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt

# end of install Node.js

COPY . /app
WORKDIR /app

RUN ./build.sh Pack

CMD ["mono", "/app/bin/FSDN/FSDN.exe", "--home-directory", "./bin/FSDN/"]
74 changes: 50 additions & 24 deletions README.md
Expand Up @@ -3,7 +3,7 @@
[![License][license-image]][license-url]

FSDN is a web application that uses [F# API Search](https://github.com/hafuu/FSharpApiSearch) library.
F# API Search library supports the standard signature of F# with some extentions as its criteria.
F# API Search library supports the standard signature of F# with some extentions as its criteria.
This document describes the F# API Search library specific formats.

## Query format specifications
Expand Down Expand Up @@ -33,7 +33,7 @@ id : 'a -> 'a
shows the following result:

````
Microsoft.FSharp.Core.Operators.id: 'T -> 'T
Microsoft.FSharp.Core.Operators.id: 'T -> 'T
````

And the following query:
Expand All @@ -45,13 +45,13 @@ choose : _
shows the followings:

````
Microsoft.FSharp.Collections.Array.choose: ('T -> option<'U>) -> 'T[] -> 'U[]
Microsoft.FSharp.Collections.ArrayModule.Parallel.choose: ('T -> option<'U>) -> 'T[] -> 'U[]
Microsoft.FSharp.Collections.List.choose: ('T -> option<'U>) -> list<'T> -> list<'U>
Microsoft.FSharp.Collections.Seq.choose: ('T -> option<'U>) -> seq<'T> -> seq<'U>
Microsoft.FSharp.Control.Event.choose: ('T -> option<'U>) -> IEvent<'Del, 'T> -> IEvent<'U>
Microsoft.FSharp.Collections.Array.choose: ('T -> option<'U>) -> 'T[] -> 'U[]
Microsoft.FSharp.Collections.ArrayModule.Parallel.choose: ('T -> option<'U>) -> 'T[] -> 'U[]
Microsoft.FSharp.Collections.List.choose: ('T -> option<'U>) -> list<'T> -> list<'U>
Microsoft.FSharp.Collections.Seq.choose: ('T -> option<'U>) -> seq<'T> -> seq<'U>
Microsoft.FSharp.Control.Event.choose: ('T -> option<'U>) -> IEvent<'Del, 'T> -> IEvent<'U>
when 'Del : delegate and 'Del :> Delegate
Microsoft.FSharp.Control.Observable.choose: ('T -> option<'U>) -> IObservable<'T> -> IObservable<'U>
Microsoft.FSharp.Control.Observable.choose: ('T -> option<'U>) -> IObservable<'T> -> IObservable<'U>
````

### Wildcard
Expand All @@ -66,17 +66,17 @@ To find them, use wildcard: `?`.
This query shows the following results:

````
Microsoft.FSharp.Collections.List.append: list<'T> -> list<'T> -> list<'T>
Microsoft.FSharp.Collections.List.averageBy: ('T -> 'U) -> list<'T> -> 'U
Microsoft.FSharp.Collections.List.append: list<'T> -> list<'T> -> list<'T>
Microsoft.FSharp.Collections.List.averageBy: ('T -> 'U) -> list<'T> -> 'U
when 'U : (static member op_Addition : 'U * 'U -> 'U) and 'U : (static member DivideByInt : 'U * int -> 'U) and 'U : (static member get_Zero : unit -> 'U)
Microsoft.FSharp.Collections.List.choose: ('T -> option<'U>) -> list<'T> -> list<'U>
Microsoft.FSharp.Collections.List.chunkBySize: int -> list<'T> -> list<list<'T>>
Microsoft.FSharp.Collections.List.collect: ('T -> list<'U>) -> list<'T> -> list<'U>
Microsoft.FSharp.Collections.List.contains: 'T -> list<'T> -> bool
Microsoft.FSharp.Collections.List.choose: ('T -> option<'U>) -> list<'T> -> list<'U>
Microsoft.FSharp.Collections.List.chunkBySize: int -> list<'T> -> list<list<'T>>
Microsoft.FSharp.Collections.List.collect: ('T -> list<'U>) -> list<'T> -> list<'U>
Microsoft.FSharp.Collections.List.contains: 'T -> list<'T> -> bool
when 'T : equality
Microsoft.FSharp.Collections.List.countBy: ('T -> 'Key) -> list<'T> -> list<'Key * int>
Microsoft.FSharp.Collections.List.countBy: ('T -> 'Key) -> list<'T> -> list<'Key * int>
when 'Key : equality
Microsoft.FSharp.Collections.List.distinctBy: ('T -> 'Key) -> list<'T> -> list<'T>
Microsoft.FSharp.Collections.List.distinctBy: ('T -> 'Key) -> list<'T> -> list<'T>
when 'Key : equality
(snip)
````
Expand Down Expand Up @@ -111,7 +111,7 @@ this doesn't match either `'a -> int` or `int -> string`.

A criteria of search instance members is formatted as `receiver => signature`.

To find methods that accept one argument, use `receiver => arg -> returnType` format.
To find methods that accept one argument, use `receiver => arg -> returnType` format.

To find methods that accept multiple arguments, use `receiver => arg1 -> arg2 -> returnType` or `receiver => arg1 * arg2 -> returnType`.
By default, tuple style method arguments (`arg1 * arg2`) and curried style (`arg1 -> arg2`) are treated as identical.
Expand All @@ -135,20 +135,20 @@ illustrates an example of these special rules.
This query matches the following methods and functions:

````
System.String.Length: int
Microsoft.FSharp.Core.String.length: string -> int
System.String.GetHashCode: unit -> int
System.String.Length: int
Microsoft.FSharp.Core.String.length: string -> int
System.String.GetHashCode: unit -> int
````

The first result `System.String.Length` matches exactly.
In addition, `Microsoft.FSharp.Core.String.length` and `System.String.GetHashCode` are also retuned
In addition, `Microsoft.FSharp.Core.String.length` and `System.String.GetHashCode` are also retuned
because the 1st and 2nd special rules are applied respectively.

#### Static members

Static members can be found by using the same query for functions and values in modules.
As the same with instance methods, both `arg1 -> arg2 -> returnType` and `arg1 * arg2 -> returnType`
can be used to find static methods that accepts multiple arguments.
can be used to find static methods that accepts multiple arguments.

### Active patterns

Expand All @@ -167,7 +167,7 @@ To find active patterns that accepts zero or more arguments, use `...` keyword a
`returnType` indicates a return type of an active pattern.
This must be different between active patterns each of which supports one case, multiple cases, and is partial active pattern,
and `option<_>` or `Choice<_,...,_>` must be specified.
Usually a wildcard (`?`) is recommended for `returnType`.
Usually a wildcard (`?`) is recommended for `returnType`.

## Search Options

Expand All @@ -177,7 +177,7 @@ When this option is enabled and when performing wildcard search,
each of the wildcards are distinguished by its name.
For instance, `?a -> ?a` matches `int -> int`,
but `?a -> ?b` doesn't match `int -> int`.
If this option is disabled, `?a -> ?b` matches `int -> int`.
If this option is disabled, `?a -> ?b` matches `int -> int`.

### `similarity` option

Expand Down Expand Up @@ -228,6 +228,32 @@ or
./build.sh mono='/usr/local/Cellar/mono/4.2.3/'
```

### Docker

```
./build-in-docker.sh
```

## How to run

### Windows

```
./bin/FSDN/FSDN.exe --home-directory ./bin/FSDN
```

### Mono

```
mono ./bin/FSDN/FSDN.exe --home-directory ./bin/FSDN
```

### Docker

```
docker run -d -p 8083:8083 --name=fsdn fsdn mono /app/FSDN/FSDN.exe --home-directory /app/FSDN/
```

[license-url]: https://github.com/fsdn-projects/FSDN/blob/master/LICENSE
[license-image]: https://img.shields.io/github/license/fsdn-projects/FSDN.svg

30 changes: 30 additions & 0 deletions build-in-docker.sh
@@ -0,0 +1,30 @@
#!/bin/bash -eux

CONTAINER=fsdn-build
IMAGE=fsdn-build

BIN=./bin

if [ -e $BIN ]; then
rm -rf $BIN
fi

mkdir -p $BIN/FSDN

docker build -t $CONTAINER -f Dockerfile-build .

docker rm $IMAGE || true

docker run -d --name=$IMAGE $CONTAINER

docker cp $IMAGE:/app/bin/FSDN.zip ./bin/

docker stop $IMAGE

docker rm $IMAGE || true
docker rmi $IMAGE

unzip -d ./bin/FSDN ./bin/FSDN.zip

docker build -t fsdn .

33 changes: 13 additions & 20 deletions build.fsx
Expand Up @@ -6,12 +6,6 @@ open System.IO

let project = "FSDN"

// List of author names (for NuGet package)
let authors = [ "pocketberserker" ]

// Tags for your project (for NuGet package)
let tags = "fsharp F#"

// File system information
let solutionFile = "FSDN.sln"

Expand All @@ -20,17 +14,6 @@ let configuration = environVarOrDefault "configuration" "Release"
// Pattern specifying assemblies to be tested using NUnit
let testAssemblies = "tests/**/bin" @@ configuration @@ "*Tests*.dll"

// Git configuration (used for publishing documentation in gh-pages branch)
// The profile where the project is posted
let gitOwner = "pocketberserker"
let gitHome = "https://github.com/" + gitOwner

// The name of the project on GitHub
let gitName = "FSDN"

// The url for the raw files hosted
let gitRaw = environVarOrDefault "gitRaw" "https://raw.github.com/pocketberserker"

// --------------------------------------------------------------------------------------
// END TODO: The rest of the file includes standard build steps
// --------------------------------------------------------------------------------------
Expand Down Expand Up @@ -129,6 +112,13 @@ Target "GenerateViews" (fun _ ->
// --------------------------------------------------------------------------------------
// Deploy

Target "Pack" (fun _ ->
let appDir = "./bin" @@ project
!! (appDir + "/**/*.*")
-- "*.zip"
|> Zip appDir ("./bin" @@ sprintf "%s.zip" project)
)

Target "DeployOnAzure" (fun _ ->
let artifacts = currentDirectory @@ ".." @@ "artifacts"
let kuduSync = findToolInSubPath "KuduSync.NET.exe" (currentDirectory @@ "packages")
Expand Down Expand Up @@ -172,9 +162,6 @@ Target "All" DoNothing
==> "CopyWebConfig"
==> "All"

"All"
==> "DeployOnAzure"

"BuildFront"
==> "All"

Expand All @@ -184,4 +171,10 @@ Target "All" DoNothing
"GenerateViews"
==> "All"

"All"
==> "Pack"

"All"
==> "DeployOnAzure"

RunTargetOrDefault "All"

0 comments on commit eb9d247

Please sign in to comment.