Skip to content

Commit e2c9a46

Browse files
author
vsilent
committed
multi stage build
1 parent 5956f4d commit e2c9a46

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ docker run --rm -it \
112112
If you want to test your current checkout instead of the latest published image:
113113

114114
```bash
115-
docker build -f docker/local/Dockerfile -t stackdog-local .
115+
docker build -f docker/backend/Dockerfile -t stackdog-local .
116116

117117
docker run --rm -it \
118118
--name stackdog-local \
@@ -202,7 +202,7 @@ for event in events {
202202
docker run --rm -it -p 5000:5000 trydirect/stackdog:latest
203203

204204
# Or, for the most reliable test of your current code, build and run your checkout
205-
docker build -f docker/local/Dockerfile -t stackdog-local .
205+
docker build -f docker/backend/Dockerfile -t stackdog-local .
206206
docker run --rm -it -p 5000:5000 stackdog-local
207207

208208
# Or run backend + UI together

docker-compose.app.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ services:
22
stackdog:
33
build:
44
context: .
5-
dockerfile: docker/local/Dockerfile
5+
dockerfile: docker/backend/Dockerfile
66
command: ["serve"]
77
container_name: stackdog
88
environment:

docker/backend/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM rust:slim-bookworm AS build
2+
3+
RUN apt-get update && \
4+
apt-get install --no-install-recommends -y musl-tools pkg-config && \
5+
rm -rf /var/lib/apt/lists/*
6+
7+
RUN rustup target add x86_64-unknown-linux-musl
8+
9+
WORKDIR /app
10+
11+
COPY Cargo.toml Cargo.lock ./
12+
COPY migrations ./migrations
13+
COPY src ./src
14+
COPY .env.sample ./.env
15+
16+
RUN cargo build --release --target x86_64-unknown-linux-musl
17+
18+
FROM debian:bookworm-slim
19+
20+
WORKDIR /app
21+
22+
RUN apt-get update && \
23+
apt-get install --no-install-recommends -y ca-certificates sqlite3 && \
24+
rm -rf /var/lib/apt/lists/* && \
25+
mkdir -p /data
26+
27+
COPY --from=build /app/target/x86_64-unknown-linux-musl/release/stackdog /app/stackdog
28+
29+
EXPOSE 5000
30+
31+
ENTRYPOINT ["/app/stackdog"]

0 commit comments

Comments
 (0)