Compare commits
6 Commits
0.9.43-alp
...
0.9.45-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e9cdeb3ee | ||
|
|
c17434703e | ||
|
|
0644eb285a | ||
|
|
0f4120c2c8 | ||
|
|
ba43561f40 | ||
|
|
046226b580 |
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -27,7 +27,7 @@ jobs:
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
run: |
|
||||
export KUBECONFIG="$(kind get kubeconfig-path)"
|
||||
# export KUBECONFIG="$(kind get kubeconfig-path)"
|
||||
make unit-test
|
||||
bash <(curl -s https://codecov.io/bash) -t ${CODECOV_TOKEN}
|
||||
|
||||
|
||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -32,7 +32,7 @@ jobs:
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
run: |
|
||||
export KUBECONFIG="$(kind get kubeconfig-path)"
|
||||
# export KUBECONFIG="$(kind get kubeconfig-path)"
|
||||
make unit-test
|
||||
|
||||
- name: build fx
|
||||
|
||||
@@ -8,7 +8,8 @@ Poor man's function as a service.
|
||||
[](https://codecov.io/gh/metrue/fx)
|
||||
[](https://goreportcard.com/report/github.com/metrue/fx)
|
||||
[](http://godoc.org/github.com/metrue/fx)
|
||||

|
||||

|
||||

|
||||
[](https://github.com/metrue/fx/releases/latest)
|
||||
|
||||
## Table of Contents
|
||||
|
||||
15
assets/dockerfiles/base/rust/Dockerfile
vendored
15
assets/dockerfiles/base/rust/Dockerfile
vendored
@@ -1,7 +1,12 @@
|
||||
FROM liuchong/rustup
|
||||
|
||||
WORKDIR /usr/src/myapp
|
||||
FROM clux/muslrust:nightly AS builder
|
||||
WORKDIR /build
|
||||
COPY . .
|
||||
RUN cp ./config ~/.cargo/ && rustup default nightly && cargo build
|
||||
RUN ln -s /usr/bin/g++ /usr/bin/musl-g++ && cargo build --release
|
||||
|
||||
FROM scratch
|
||||
WORKDIR /usr/src/myapp
|
||||
COPY --from=builder /build/target/x86_64-unknown-linux-musl/release/rust /usr/src/myapp/
|
||||
COPY ./Rocket.toml /usr/src/myapp/
|
||||
EXPOSE 3000
|
||||
CMD ["cargo", "run"]
|
||||
ENV ROCKET_ENV=prod
|
||||
CMD ["/usr/src/myapp/rust"]
|
||||
|
||||
18
assets/dockerfiles/base/rust/Rocket.toml
vendored
18
assets/dockerfiles/base/rust/Rocket.toml
vendored
@@ -1,5 +1,23 @@
|
||||
[development]
|
||||
address = "localhost"
|
||||
port = 3000
|
||||
workers = 8
|
||||
keep_alive = 5
|
||||
log = "normal"
|
||||
limits = { forms = 32768 }
|
||||
|
||||
[staging]
|
||||
address = "0.0.0.0"
|
||||
port = 3000
|
||||
workers = 8
|
||||
keep_alive = 5
|
||||
log = "normal"
|
||||
limits = { forms = 32768 }
|
||||
|
||||
[production]
|
||||
address = "0.0.0.0"
|
||||
port = 3000
|
||||
workers = 8
|
||||
keep_alive = 5
|
||||
log = "critical"
|
||||
limits = { forms = 32768 }
|
||||
|
||||
2
fx.go
2
fx.go
@@ -19,7 +19,7 @@ import (
|
||||
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
|
||||
)
|
||||
|
||||
const version = "0.9.43"
|
||||
const version = "0.9.45"
|
||||
|
||||
func init() {
|
||||
go checkForUpdate()
|
||||
|
||||
@@ -44,7 +44,7 @@ func Build(ctx context.Contexter) (err error) {
|
||||
language := ctx.Get("language").(string)
|
||||
host := ctx.Get("host").(string)
|
||||
kubeconf := ctx.Get("kubeconf").(string)
|
||||
name := ctx.Get("name").(string)
|
||||
name := fmt.Sprintf("%s-%s", ctx.Get("name").(string), time.Now().Format("20060102150405"))
|
||||
|
||||
if err := bundle.Bundle(workdir, language, fn, deps...); err != nil {
|
||||
return err
|
||||
@@ -63,7 +63,7 @@ func Build(ctx context.Contexter) (err error) {
|
||||
if err := docker.BuildImage(ctx.GetContext(), workdir, name); err != nil {
|
||||
return err
|
||||
}
|
||||
nameWithTag := name + ":latest"
|
||||
nameWithTag := fmt.Sprintf("%s:latest", name)
|
||||
if err := docker.TagImage(ctx.GetContext(), name, nameWithTag); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -24,10 +24,8 @@ func set(ctx context.Contexter, cli *cli.Context, fields []argsField) error {
|
||||
if len(addr) != 2 {
|
||||
return fmt.Errorf("invalid host information, should be format of <user>@<ip>")
|
||||
}
|
||||
user := addr[0]
|
||||
ip := addr[1]
|
||||
ctx.Set("host", ip)
|
||||
ctx.Set("user", user)
|
||||
ctx.Set("host", addr[1])
|
||||
ctx.Set("user", addr[0])
|
||||
} else {
|
||||
ctx.Set(f.Name, cli.String(f.Name))
|
||||
}
|
||||
@@ -38,7 +36,16 @@ func set(ctx context.Contexter, cli *cli.Context, fields []argsField) error {
|
||||
}
|
||||
|
||||
if f.Env != "" && os.Getenv(f.Env) != "" {
|
||||
ctx.Set(f.Name, os.Getenv(f.Env))
|
||||
if f.Name == "host" {
|
||||
info := strings.Split(os.Getenv(f.Env), "@")
|
||||
if len(info) != 2 {
|
||||
return fmt.Errorf("invalid host information, should be format of <user>@<ip>")
|
||||
}
|
||||
ctx.Set("host", info[1])
|
||||
ctx.Set("user", info[0])
|
||||
} else {
|
||||
ctx.Set(f.Name, os.Getenv(f.Env))
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user