🏡 index : ~doyle/chartered.git

author Jordan Doyle <jordan@doyle.la> 2021-09-29 2:31:44.0 +01:00:00
committer Jordan Doyle <jordan@doyle.la> 2021-09-29 2:31:44.0 +01:00:00
commit
23ea4c6e50460e78eab053151ae4252a8361528b [patch]
tree
ac0c6ddf999fea91e0cba93d33a4f036e7cad669
parent
bc9fe1921ea1dd85a6828b12d6c902e2aa0c17b5
download
23ea4c6e50460e78eab053151ae4252a8361528b.tar.gz

Build dockerfiles for chartered-web & chartered-git



Diff

 Dockerfile                               | 21 +++++++++++++++++++++
 book/src/getting-started/installation.md | 16 ++++++++++++++--
 2 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..7e10eaa 100644
--- /dev/null
+++ a/Dockerfile
@@ -1,0 +1,21 @@
FROM rust:alpine AS builder
RUN apk add --update gcc g++ build-base alpine-sdk sqlite-dev
WORKDIR /app
COPY . /app
RUN cargo build --release

FROM alpine AS chartered-git
RUN apk add --update sqlite sqlite-dev && \
    ln -s /lib/ld-musl-$(uname -m).so.1 /lib/ld-linux-$(uname -m).so.1
WORKDIR /app
COPY --from=builder /app/target/release/chartered-git /app/chartered-git
ENV RUST_LOG=info
ENTRYPOINT ["/app/chartered-git"]

FROM alpine AS chartered-web
RUN apk add --update sqlite sqlite-dev && \
    ln -s /lib/ld-musl-$(uname -m).so.1 /lib/ld-linux-$(uname -m).so.1
WORKDIR /app
COPY --from=builder /app/target/release/chartered-web /app/chartered-web
ENV RUST_LOG=info
ENTRYPOINT ["/app/chartered-web"]
diff --git a/book/src/getting-started/installation.md b/book/src/getting-started/installation.md
index 58fbb01..71c7c83 100644
--- a/book/src/getting-started/installation.md
+++ a/book/src/getting-started/installation.md
@@ -27,19 +27,21 @@
Using the recommended setup, S3 & PostgreSQL:

```toml

bind-address = "127.0.0.1:8080"
bind-address = "127.0.0.1:8080" # hint: use a different port for each service
database-uri = "postgres://user:password@localhost/chartered"

# unlike the above two options, this configuration value should only be supplied
# for chartered-web
# the below configuration options should only be set for chartered-web
crate-store  = "s3://s3-eu-west-1.amazonaws.com/my-cool-crate-store/"
frontend-url = "https://my.instance.chart.rs" # this is used for CORS
                                              # if unset defaults to *

```


Or, using the defaults as an example:
Or, using the defaults of `chartered-web` as an example:

```toml

bind-address = "127.0.0.1:8899"
database-uri = "sqlite://chartered.db"

crate-store  = "file:///tmp/chartered"
```


@@ -58,8 +60,10 @@
to run on your own server without another way of hosting static content:

```sh

$ DOCKER_BUILDKIT=0 docker build https://github.com/w4/chartered.git#main:chartered-frontend \
    --build-arg BASE_URL=https://my.instance.chart.rs -t chartered-frontend:master

$ DOCKER_BUILDKIT=0 docker build \
    https://github.com/w4/chartered.git#main:chartered-frontend \

    --build-arg BASE_URL=https://api.my.instance.chart.rs \

    -t chartered-frontend:master

$ docker run -p 8080:80 chartered-frontend:master
$ curl http://127.0.0.1:8080
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8">...