Skip to content

Commit de69513

Browse files
committed
Remove database from git
1 parent 1029d34 commit de69513

File tree

7 files changed

+37
-9
lines changed

7 files changed

+37
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sqlite/toast.db

backend/Config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
rust_log = "toast=trace,warn" # default: info
44

55
[database]
6-
url = "sqlite://../sqlite.db"
6+
url = "sqlite://../sqlite/toast.db"

compose.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
environment:
99
HOST: "0.0.0.0"
1010
RUST_LOG: "toast=info,warn"
11-
DATABASE__URL: "sqlite://sqlite.db"
11+
DATABASE__URL: "sqlite://sqlite/toast.db"
1212
depends_on:
1313
db-migrate:
1414
condition: service_completed_successfully
@@ -18,14 +18,20 @@ services:
1818
db-migrate:
1919
build:
2020
dockerfile: "sqlx.Dockerfile"
21+
pull_policy: build
2122
working_dir: "/app"
22-
command: [ "migrate", "run", "--source", "migrations", "--source", "fixtures" ]
23+
user: "1000:1000"
24+
entrypoint: >
25+
/bin/sh -c " \
26+
touch sqlite/toast.db && \
27+
sqlx migrate run --source migrations --source fixtures \
28+
"
2329
volumes:
2430
- "./migrations:/app/migrations:ro"
2531
- "./fixtures:/app/fixtures:ro"
26-
- "./sqlite.db:/app/sqlite.db:rw"
32+
- "./sqlite:/app/sqlite:rw"
2733
environment:
28-
DATABASE_URL: "sqlite://sqlite.db"
34+
DATABASE_URL: "sqlite://sqlite/toast.db"
2935

3036
object-store:
3137
image: quay.io/minio/minio

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ up:
55
down:
66
docker compose down -v
77
gen:
8-
cd backend && DATABASE_URL=sqlite://../sqlite.db cargo sqlx prepare && cd ../frontend && deno i --allow-scripts && deno task prepare
8+
cd backend && DATABASE_URL=sqlite://../sqlite/toast.db cargo sqlx prepare && cd ../frontend && deno i --allow-scripts && deno task prepare
99
dev:
1010
cd frontend && deno task dev
1111
fmt:

sqlite.db

-20 KB
Binary file not shown.

sqlite/.gitkeep

Whitespace-only changes.

sqlx.Dockerfile

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
1-
FROM rust:latest
1+
FROM --platform=$BUILDPLATFORM rust:latest AS build
22

3-
RUN cargo install --git https://github.com/Tortoaster/sqlx.git --rev 6c70021 sqlx-cli --no-default-features --features rustls,sqlite
3+
ARG TARGETPLATFORM
4+
ARG BUILDPLATFORM
45

5-
ENTRYPOINT [ "sqlx" ]
6+
RUN apt-get update
7+
RUN apt-get install -y musl-tools
8+
RUN apt-get clean
9+
10+
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
11+
wget https://musl.cc/aarch64-linux-musl-cross.tgz && \
12+
tar -xzf aarch64-linux-musl-cross.tgz -C /usr/local && \
13+
export PATH="/usr/local/aarch64-linux-musl-cross/bin:$PATH" && \
14+
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-musl-gcc && \
15+
export TARGET=aarch64-unknown-linux-musl; \
16+
else \
17+
export TARGET=x86_64-unknown-linux-musl; \
18+
fi && \
19+
rustup target add $TARGET && \
20+
cargo install --target $TARGET --git https://github.com/Tortoaster/sqlx.git --rev 0c9b586 sqlx-cli --no-default-features --features rustls,sqlite
21+
22+
FROM alpine:latest
23+
24+
COPY --from=build /usr/local/cargo/bin/sqlx /usr/local/bin
25+
26+
ENTRYPOINT [ "/usr/local/bin/sqlx" ]

0 commit comments

Comments
 (0)