🏡 index : ~doyle/chartered.git

author Jordan Doyle <jordan@doyle.la> 2021-09-29 22:45:10.0 +01:00:00
committer Jordan Doyle <jordan@doyle.la> 2021-09-29 22:45:10.0 +01:00:00
commit
5bd04a5fb46f7e2bcff4e0d4db4dd13cc405d5e5 [patch]
tree
19303731815d8802c6ceba804aed077eab19e41a
parent
19b77083bbe8b78f86de0982a718a972612c3479
download
5bd04a5fb46f7e2bcff4e0d4db4dd13cc405d5e5.tar.gz

build with postgres support



Diff

 Cargo.lock              | 11 +++++++++++
 Dockerfile              | 10 +++++++++-
 chartered-db/Cargo.toml |  2 +-
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index f9c73bf..59835fe 100644
--- a/Cargo.lock
+++ a/Cargo.lock
@@ -394,10 +394,12 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b28135ecf6b7d446b43e27e225622a038cc4e2930a1022f51cdb97ada19b8e4d"
dependencies = [
 "bitflags",
 "byteorder",
 "chrono",
 "diesel_derives",
 "libsqlite3-sys",
 "pq-sys",
 "r2d2",
]

@@ -1133,6 +1135,15 @@
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"

[[package]]
name = "pq-sys"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ac25eee5a0582f45a67e837e350d784e7003bd29a5f460796772061ca49ffda"
dependencies = [
 "vcpkg",
]

[[package]]
name = "proc-macro-hack"
diff --git a/Dockerfile b/Dockerfile
index b86b97d..1da89a9 100644
--- a/Dockerfile
+++ a/Dockerfile
@@ -1,16 +1,20 @@
FROM rust:alpine AS builder
RUN apk add --update gcc g++ build-base alpine-sdk sqlite-dev
RUN apk add --update gcc g++ build-base alpine-sdk sqlite-dev openssl-dev postgresql-dev
WORKDIR /app
COPY . /app
RUN cargo build --release

FROM scratch AS chartered-git
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 scratch AS chartered-web
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
diff --git a/chartered-db/Cargo.toml b/chartered-db/Cargo.toml
index e8ce0c8..a95249d 100644
--- a/chartered-db/Cargo.toml
+++ a/chartered-db/Cargo.toml
@@ -12,7 +12,7 @@
base64 = "0.13"
bitflags = "1"
chrono = "0.4"
diesel = { version = "1", features = ["sqlite", "r2d2", "chrono"] }
diesel = { version = "1", features = ["sqlite", "postgres", "r2d2", "chrono"] }
diesel_logger = "0.1"
diesel_migrations = "1.4"
displaydoc = "0.2"