Fix sqlx in docker build

This commit is contained in:
Andras Schmelczer 2024-12-18 22:56:40 +00:00
parent 9eae874c02
commit 607937edda
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
2 changed files with 6 additions and 1 deletions

View file

@ -1,3 +1,4 @@
target
Dockerfile
.dockerignore
db.sqlite3

View file

@ -1,12 +1,16 @@
FROM rust:1.83 as builder
FROM rust:1.83 AS builder
WORKDIR /usr/src/backend
RUN apt update && apt install -y musl-tools
RUN rustup target add x86_64-unknown-linux-musl
RUN cargo install sqlx-cli
COPY . .
RUN sqlx database create --database-url sqlite://db.sqlite3
RUN sqlx migrate run --source sync_server/src/database/migrations --database-url sqlite://db.sqlite3
RUN cargo build --package sync_server --release --target x86_64-unknown-linux-musl
FROM alpine:3.21.0