From b629a8e2fbc7253456b723055f423bc829ee220b Mon Sep 17 00:00:00 2001 From: Alphonse Paix Date: Sun, 28 Sep 2025 04:29:52 +0200 Subject: [PATCH] dockerfile and sqlx queries data --- .dockerignore | 4 ++ ...b572bec7e04a6f3324aa17de7e7a9b1fb32ef.json | 22 +++++++++ ...ea84d8cb09502b24c11dbb8d403419899dfd1.json | 20 ++++++++ ...dcc39032f308f211f603dfcf539b7b071b8e3.json | 47 +++++++++++++++++++ ...e8167c942e395687cd5ffecb7c064ca2dde70.json | 14 ++++++ Dockerfile | 5 +- 6 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 .sqlx/query-4141df8c45db179016d8e87b023b572bec7e04a6f3324aa17de7e7a9b1fb32ef.json create mode 100644 .sqlx/query-68a00cae18e40dc76ffea61dfc0ea84d8cb09502b24c11dbb8d403419899dfd1.json create mode 100644 .sqlx/query-a6cb227efa5ac12189e662d68b8dcc39032f308f211f603dfcf539b7b071b8e3.json create mode 100644 .sqlx/query-b47161386b21432693aa3827963e8167c942e395687cd5ffecb7c064ca2dde70.json diff --git a/.dockerignore b/.dockerignore index fc88846..b8c4919 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,3 +4,7 @@ Dockerfile /scripts /migrations +/node_modules +/assets/css/main.css +/.cargo +/.github diff --git a/.sqlx/query-4141df8c45db179016d8e87b023b572bec7e04a6f3324aa17de7e7a9b1fb32ef.json b/.sqlx/query-4141df8c45db179016d8e87b023b572bec7e04a6f3324aa17de7e7a9b1fb32ef.json new file mode 100644 index 0000000..c4039ea --- /dev/null +++ b/.sqlx/query-4141df8c45db179016d8e87b023b572bec7e04a6f3324aa17de7e7a9b1fb32ef.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM subscriptions WHERE id = $1 RETURNING email", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "email", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false + ] + }, + "hash": "4141df8c45db179016d8e87b023b572bec7e04a6f3324aa17de7e7a9b1fb32ef" +} diff --git a/.sqlx/query-68a00cae18e40dc76ffea61dfc0ea84d8cb09502b24c11dbb8d403419899dfd1.json b/.sqlx/query-68a00cae18e40dc76ffea61dfc0ea84d8cb09502b24c11dbb8d403419899dfd1.json new file mode 100644 index 0000000..6397e62 --- /dev/null +++ b/.sqlx/query-68a00cae18e40dc76ffea61dfc0ea84d8cb09502b24c11dbb8d403419899dfd1.json @@ -0,0 +1,20 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT count(*) FROM subscriptions", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "count", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + null + ] + }, + "hash": "68a00cae18e40dc76ffea61dfc0ea84d8cb09502b24c11dbb8d403419899dfd1" +} diff --git a/.sqlx/query-a6cb227efa5ac12189e662d68b8dcc39032f308f211f603dfcf539b7b071b8e3.json b/.sqlx/query-a6cb227efa5ac12189e662d68b8dcc39032f308f211f603dfcf539b7b071b8e3.json new file mode 100644 index 0000000..9b17cd1 --- /dev/null +++ b/.sqlx/query-a6cb227efa5ac12189e662d68b8dcc39032f308f211f603dfcf539b7b071b8e3.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT * FROM subscriptions ORDER BY subscribed_at DESC LIMIT $1 OFFSET $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "email", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "subscribed_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 3, + "name": "status", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "unsubscribe_token", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Int8", + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false, + true + ] + }, + "hash": "a6cb227efa5ac12189e662d68b8dcc39032f308f211f603dfcf539b7b071b8e3" +} diff --git a/.sqlx/query-b47161386b21432693aa3827963e8167c942e395687cd5ffecb7c064ca2dde70.json b/.sqlx/query-b47161386b21432693aa3827963e8167c942e395687cd5ffecb7c064ca2dde70.json new file mode 100644 index 0000000..27728cb --- /dev/null +++ b/.sqlx/query-b47161386b21432693aa3827963e8167c942e395687cd5ffecb7c064ca2dde70.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM posts WHERE post_id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [] + }, + "hash": "b47161386b21432693aa3827963e8167c942e395687cd5ffecb7c064ca2dde70" +} diff --git a/Dockerfile b/Dockerfile index fa60aef..53d04f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ FROM lukemathwalker/cargo-chef:latest-rust-1.89.0 AS chef WORKDIR /app +RUN apt update && apt install -y nodejs npm && rm -rf /var/lib/apt/lists/* FROM chef AS planner COPY . . @@ -7,12 +8,11 @@ RUN cargo chef prepare --recipe-path recipe.json FROM chef AS builder COPY --from=planner /app/recipe.json recipe.json -RUN apt update -y \ - && apt install -y --no-install-recommends clang mold RUN cargo chef cook --release --recipe-path recipe.json COPY . . ENV SQLX_OFFLINE=true RUN cargo build --release --bin zero2prod +RUN npm install && npm run build-css FROM debian:bookworm-slim AS runtime WORKDIR /app @@ -22,6 +22,7 @@ RUN apt update -y \ && apt clean -y \ && rm -rf /var/lib/apt/lists/* COPY --from=builder /app/target/release/zero2prod zero2prod +COPY assets assets COPY configuration configuration ENV APP_ENVIRONMENT=production ENTRYPOINT [ "./zero2prod" ]