Skip to content
This repository was archived by the owner on Nov 5, 2021. It is now read-only.

Commit d712999

Browse files
committed
Update to use Go 1.13
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent 05666ae commit d712999

File tree

10 files changed

+63
-23
lines changed

10 files changed

+63
-23
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
jaas
1+
/bin/*
2+
/jaas
23

.travis.yml

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ sudo: required
22

33
services:
44
- docker
5-
before_install:
6-
- docker pull golang:1.9.2
75

86
script:
97
- make docker
10-

Dockerfile

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
FROM golang:1.11 as build
1+
FROM golang:1.13 as build
22

3-
LABEL maintainer [email protected]
3+
ENV GO111MODULE=off
44
ENV CGO_ENABLED=0
5+
6+
LABEL maintainer [email protected]
7+
58
RUN mkdir -p /go/src/github.com/alexellis/jaas
69
WORKDIR /go/src/github.com/alexellis/jaas
710

@@ -15,7 +18,7 @@ RUN VERSION=$(git describe --all --exact-match `git rev-parse HEAD` | grep tags
1518
&& GIT_COMMIT=$(git rev-list -1 HEAD) \
1619
&& CGO_ENABLED=0 GOOS=linux go build --ldflags "-s -w -X github.com/alexellis/jaas/version.GitCommit=${GIT_COMMIT} -X github.com/alexellis/jaas/version.Version=${VERSION}" -a -installsuffix cgo -o /root/jaas
1720

18-
FROM alpine:3.10
21+
FROM alpine:3.11
1922

2023
WORKDIR /root/
2124
COPY --from=build /root/jaas /root/jaas

Makefile

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1+
.PHONY: all linux darwin docker
12

2-
linux:
3-
CGO_ENABLED=0 GOOS=linux go build -a -ldflags "-s -w" -installsuffix cgo -o ./jaas
3+
Version := $(shell git describe --tags --dirty)
4+
GitCommit := $(shell git rev-parse HEAD)
5+
LDFLAGS := "-s -w -X main.Version=$(Version) -X main.GitCommit=$(GitCommit)"
6+
all: darwin linux
7+
8+
LDFLAGS := "-s -w -X main.Version=$(Version) -X main.GitCommit=$(GitCommit)"
49

10+
linux:
11+
CGO_ENABLED=0 GOOS=linux go build -ldflags $(LDFLAGS) -a -installsuffix cgo -o bin/jaas
12+
linux-armhf:
13+
CGO_ENABLED=0 GOOS=linux go build -ldflags $(LDFLAGS) -a -installsuffix cgo -o bin/jaas-armhf
514
darwin:
6-
CGO_ENABLED=0 GOOS=darwin go build -a -ldflags "-s -w" -installsuffix cgo -o ./jaas
15+
CGO_ENABLED=0 GOOS=darwin go build -ldflags $(LDFLAGS) -a -installsuffix cgo -o bin/jaas-darwin
716

817
docker:
918
docker build -t alexellis2/jaas:latest .

README.md

+17-6
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Now test `jaas` with `jaas --help`
5656

5757
* Run your first one-shot container with `jaas run`:
5858

59-
```
59+
```bash
6060
# jaas run -r --image alexellis2/cows:latest
6161
```
6262

@@ -68,24 +68,31 @@ The `-r` flag removes the Swarm service that was used to run your container.
6868

6969
If you aren't interested in the output logs then run it with the `--show-logs=false` override:
7070

71-
```
71+
```bash
7272
# jaas run --image alexellis2/cows:latest --show-logs=false
7373
```
7474

7575
* Override the command of the container
7676

77-
```
77+
```bash
7878
# jaas run --image alpine:3.8 --command "uname -a"
7979

8080
Printing service logs
8181
w2018-02-06T13:40:00.131678932Z Linux f56d298c4ab9 4.9.75-linuxkit-aufs #1 SMP Tue Jan 9 10:58:17 UTC 2018 x86_64 Linux
8282
```
8383

84+
You can also try the example in `examples/gotask`:
85+
86+
87+
```bash
88+
# jaas run -r --image alexellis2/go-task:2020-03-11
89+
```
90+
8491
* Environment variables
8592

8693
Set environment variables with `--env` or `-e`:
8794

88-
```
95+
```bash
8996
# jaas run --image alpine:3.8 --env ENV1=val1 --env ENV2=val2 --command "env"
9097

9198
Service created: inspiring_elion (j90qjtc14usgps9t60tvogmts)
@@ -110,7 +117,7 @@ Removing service...
110117

111118
By default, the service is removed after it completes. To prevent that, run with the `--remove` or `-r` flag set to `false`:
112119

113-
```
120+
```bash
114121
# jaas run --image alpine:3.8 --remove=false
115122

116123
Service created: zen_hoover (nwf2zey3i387zkx5gp7yjk053)
@@ -151,7 +158,7 @@ $ jaas run --registry="`echo $auth | base64`" --image my.reg.domain/hello-world:
151158

152159
To give the service access to an _existing secret_. run with the `--secret` or `-s` flag:
153160

154-
```
161+
```bash
155162
$ echo -n "S3_ACCESS_KEY_HERE" | docker secret create s3-access-key -
156163
$ jaas run --image alpine:3.7 --secret s3-access-key --command "cat /run/secrets/s3-access-key"
157164

@@ -211,6 +218,10 @@ Todo:
211218
* When task logs are available in the API this will be used instead of service logs.
212219
* When event streams are released they will prevent the need to poll continually
213220
221+
## Similar tools
222+
223+
* [kjob](https://github.com/stefanprodan/kjob) by Stefan Prodan appears to be a close variation of jaas, but for Kubernetes.
224+
214225
## Contributions are welcome
215226
216227
See the [contributing guide](CONTRIBUTING.md) and do not raise a PR unless you've read it all.

examples/gotask/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/gotask

examples/gotask/Dockerfile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM golang:1.13 as build
2+
3+
ENV GO111MODULE=off
4+
ENV CGO_ENABLED=0
5+
6+
LABEL maintainer [email protected]
7+
8+
RUN mkdir -p /go/src/github.com/alexellis/jaas/gotask
9+
WORKDIR /go/src/github.com/alexellis/jaas/gotask
10+
11+
COPY . .
12+
13+
RUN CGO_ENABLED=0 GOOS=linux go build --ldflags "-s -w" -a -installsuffix cgo -o /bin/gotask
14+
15+
FROM alpine:3.11
16+
17+
WORKDIR /root/
18+
COPY --from=build /bin/gotask /bin/gotask
19+
20+
ENTRYPOINT ["/bin/gotask"]
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
This task will print out the hostname of the running container and can be used to test JaaS.
2+
3+
```
4+
docker build -t alexellis2/go-task:2020-03-11 .
5+
```
6+
File renamed without changes.

samples/gotask/Dockerfile

-7
This file was deleted.

0 commit comments

Comments
 (0)