Skip to content
This repository was archived by the owner on Jun 9, 2022. It is now read-only.

Commit dd8d4d0

Browse files
committed
Update Dockerfile
- Update rust version in docker to `1.45.2`. - Update README.md to add examples for release docker build.
1 parent a91d8c7 commit dd8d4d0

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@ Inspired by [Meh's blog post](https://meh.schizofreni.co/2020-04-18/comfy-web-se
1717
It all started here → [meh/meh.github.io#5](https://github.com/meh/meh.github.io/issues/5#issuecomment-652088596)
1818

1919
## To get started
20+
2021
Run docker-compose up to get the PostgreSQL, Redis and Adminer running Along with our Web API Service.
2122
This starts the application in debug mode with auto reload on changes in the source.
23+
2224
```
2325
docker-compose up
2426
```
27+
2528
Migrations are handled using [movine](https://github.com/byronwasti/movine), This is run inside the debug start script.
2629
Adminer instance could be accessed from `http://localhost:8080`. Refer `docker-compose.yml` file for configurations and access credentials.
2730
If you are not using docker-compose to start the application, install movine using `cargo install movine`.
@@ -36,6 +39,21 @@ movine fix # assuming movine is installed, to install movine `cargo install movi
3639
RUST_LOG=info cargo run
3740
```
3841

42+
## Release docker build example
43+
44+
```
45+
export DATABASE_URL=postgres://mydb:[email protected]:5432/mydb # this is required for the build to work, this needed for sqlx macros to verify schema
46+
docker build -t warp-api-release:latest -f release.Dockerfile --build-arg DATABASE_URL .
47+
```
48+
49+
### Run the docker example
50+
51+
```
52+
docker run --rm -it -p 3535:3535 --env-file .env -e HOST="0.0.0.0:3535" warp-api-release:latest
53+
```
54+
55+
Refer `.env.sample` file for the env variables required.
56+
3957
## Contributions
4058

4159
With your help we can make this a real good starter template for starting a web service.

debug.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Stage 1 - build
2-
FROM rust:1.44-slim as build-deps
2+
FROM rust:1.45.2-slim as build-deps
33

44
LABEL maintainer="[email protected]"
55
LABEL version=1.0

release.Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Stage 1 - build
2-
FROM rust:1.44-slim as build-deps
2+
FROM rust:1.45.2-slim as build-deps
33

44
WORKDIR /usr/src/web-app
55

@@ -10,6 +10,7 @@ RUN apt-get install -y clang llvm-dev libclang-dev
1010
COPY Cargo.* ./
1111
COPY src/ src/
1212

13+
ARG DATABASE_URL
1314
RUN cargo install --path .
1415

1516
# Stage 2 - deploy

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub struct Args {
4141
#[clap(short, long, env)]
4242
session_lifetime: Option<i64>,
4343

44-
#[clap(default_value = "127.0.0.1:3535")]
44+
#[clap(default_value = "127.0.0.1:3535", env)]
4545
host: SocketAddr,
4646
}
4747

0 commit comments

Comments
 (0)