Skip to content

Commit

Permalink
Update Dockerfile instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
w4 committed Oct 30, 2021
1 parent 5fd9217 commit a2337df
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@ FROM rust:alpine AS builder
RUN apk add --update gcc g++ build-base alpine-sdk sqlite-dev openssl-dev postgresql-dev
WORKDIR /app
COPY . /app
RUN cargo build --release
RUN cargo build --release --features postgres

FROM alpine AS chartered-git
RUN apk add --update postgresql-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=debug
ENTRYPOINT ["/app/chartered-git"]

FROM alpine AS chartered-web
RUN apk add --update postgresql-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=debug
ENTRYPOINT ["/app/chartered-web"]
33 changes: 21 additions & 12 deletions book/src/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@ and store crate files in `/tmp/chartered`, configuration away from these default

Using the recommended setup, S3 & PostgreSQL:


#### `chartered-web` config

```toml
bind_address = "127.0.0.1:8080" # hint: use a different port for each service
bind_address = "127.0.0.1:8080"
database_uri = "postgres://user:password@localhost/chartered"

# the below configuration options should only be set for chartered-web
storage_uri = "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 *
frontend_base_uri = "http://localhost:1234/"

[auth.password]
enabled = true

# openid connect provider
[auth.gitlab]
Expand All @@ -44,13 +47,17 @@ client_id = "[client-id]"
client_secret = "[client-secret]"
```

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

```toml
bind_address = "127.0.0.1:8899"
database_uri = "sqlite://chartered.db"

storage_uri = "file:///tmp/chartered"
bind_address = "127.0.0.1:2233"
database_uri = "postgres://user:password@localhost/chartered" # can also be `sqlite://`
web_base_uri = "http://localhost:8888/"

[committer]
name = "Chartered"
email = "[email protected]"
message = "Updated crates!"
```

These configuration files can be passed into each binary using the `-c` CLI argument.
Expand All @@ -68,8 +75,8 @@ $ docker build https://github.com/w4/chartered.git#main \
$ docker build https://github.com/w4/chartered.git#main \
--target chartered-git \
-t chartered-git:master
$ docker run -d chartered-web
$ docker run -d chartered-git
$ docker -v $PWD/web-config.toml:/config.toml run -d chartered-web --config /config.toml
$ docker -v $PWD/git-config.toml:/config.toml run -d chartered-git --config /config.toml
```

[gh-issue]: https://github.com/w4/chartered/issues
Expand All @@ -92,4 +99,6 @@ $ curl http://127.0.0.1:8080
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8">...
```

Where `BASE_URL` points to the `chartered-web` instance.

[sws]: https://github.com/joseluisq/static-web-server

0 comments on commit a2337df

Please sign in to comment.