fix containerization
This commit is contained in:
parent
9818df10f7
commit
efd6cf1fb3
5 changed files with 28 additions and 8 deletions
|
|
@ -3,6 +3,6 @@
|
||||||
example.env
|
example.env
|
||||||
build
|
build
|
||||||
dev-services
|
dev-services
|
||||||
bacon.toml
|
|
||||||
target
|
target
|
||||||
|
node_modules
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,4 +1,5 @@
|
||||||
target
|
target
|
||||||
|
.sqlx
|
||||||
.env
|
.env
|
||||||
.DS_Store
|
.DS_Store
|
||||||
node_modules
|
node_modules
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
FROM lukemathwalker/cargo-chef:latest-rust-1.87.0 AS chef
|
FROM docker.io/rustlang/rust:nightly AS chef
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
RUN cargo install cargo-chef && rm -rf $CARGO_HOME/registry/
|
||||||
|
|
||||||
FROM chef AS planner
|
FROM chef AS planner
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
@ -11,16 +12,21 @@ COPY --from=planner /app/recipe.json recipe.json
|
||||||
RUN cargo chef cook --release --recipe-path recipe.json
|
RUN cargo chef cook --release --recipe-path recipe.json
|
||||||
# Build application
|
# Build application
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN cargo build --release --bin phonograph
|
RUN cargo build --release --bin phono-server
|
||||||
|
|
||||||
# We do not need the Rust toolchain to run the binary!
|
# We do not need the Rust toolchain to run the binary!
|
||||||
FROM debian:bookworm-slim AS runtime
|
FROM debian:bookworm-slim AS runtime
|
||||||
RUN apt-get update && apt-get install -y libpq-dev
|
RUN apt-get update && apt-get install -y libpq-dev ca-certificates
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=builder /app/target/release/phonograph /usr/local/bin
|
# User should be set by UID to make the K8s `runAsNonRoot` check's job easier.
|
||||||
|
RUN useradd -m -u 1000 app
|
||||||
|
USER 1000
|
||||||
|
|
||||||
|
WORKDIR /home/app
|
||||||
|
COPY --from=builder /app/target/release/phono-server /usr/local/bin
|
||||||
|
|
||||||
COPY ./css_dist ./css_dist
|
COPY ./css_dist ./css_dist
|
||||||
COPY ./js_dist ./js_dist
|
COPY ./js_dist ./js_dist
|
||||||
COPY ./static ./static
|
COPY ./static ./static
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/phonograph"]
|
ENTRYPOINT ["/usr/local/bin/phono-server"]
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
create user app createdb createrole password 'guest';
|
||||||
|
grant connect on database postgres to app;
|
||||||
|
|
||||||
|
create schema app;
|
||||||
|
grant usage, create on schema app to app;
|
||||||
|
alter role app set search_path = app;
|
||||||
|
|
@ -4,6 +4,7 @@ rebar = "latest"
|
||||||
rust = { version = "nightly", components = "rust-analyzer,clippy,rustc-codegen-cranelift-preview" }
|
rust = { version = "nightly", components = "rust-analyzer,clippy,rustc-codegen-cranelift-preview" }
|
||||||
watchexec = "latest"
|
watchexec = "latest"
|
||||||
"github:sass/dart-sass" = "1.89.2"
|
"github:sass/dart-sass" = "1.89.2"
|
||||||
|
"cargo:sqlx-cli" = "0.8.6"
|
||||||
|
|
||||||
[tasks.dev-services]
|
[tasks.dev-services]
|
||||||
run = "docker compose up"
|
run = "docker compose up"
|
||||||
|
|
@ -30,6 +31,12 @@ run = "docker compose up"
|
||||||
[tasks.pg-container]
|
[tasks.pg-container]
|
||||||
run = "sh ./dev-services/run-pg-with-apple-container.sh"
|
run = "sh ./dev-services/run-pg-with-apple-container.sh"
|
||||||
|
|
||||||
|
[tasks.migrations]
|
||||||
|
dir = "./phono-models"
|
||||||
|
run = "sqlx migrate run"
|
||||||
|
|
||||||
|
[tasks.prepare-sqlx]
|
||||||
|
run = "cargo sqlx prepare --workspace"
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
RUST_LOG = "debug"
|
RUST_LOG = "debug"
|
||||||
RUST_BACKTRACE = "1"
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue