mirror of
https://github.com/cupcakearmy/cryptgeon.git
synced 2025-04-10 19:33:00 +00:00
docker image
This commit is contained in:
parent
8d5e348f56
commit
0e47dab6d4
@ -1,5 +1,4 @@
|
||||
*
|
||||
!/entry.sh
|
||||
|
||||
!/backend/src
|
||||
!/backend/Cargo.lock
|
||||
@ -13,3 +12,4 @@
|
||||
!/frontend/pnpm-lock.yaml
|
||||
!/frontend/svelte.config.js
|
||||
!/frontend/tsconfig.json
|
||||
!/frontend/vite.config.js
|
||||
|
@ -1,7 +1,7 @@
|
||||
# FRONTEND
|
||||
FROM node:16-alpine as client
|
||||
WORKDIR /tmp
|
||||
RUN npm install -g pnpm
|
||||
RUN npm install -g pnpm@7
|
||||
COPY ./frontend ./
|
||||
RUN pnpm install
|
||||
RUN pnpm run build
|
||||
@ -18,9 +18,8 @@ RUN cargo build --release
|
||||
# RUNNER
|
||||
FROM alpine
|
||||
WORKDIR /app
|
||||
COPY ./entry.sh .
|
||||
COPY --from=backend /tmp/target/release/cryptgeon .
|
||||
COPY --from=client /tmp/build ./frontend/build
|
||||
ENV REDIS=redis://redis/
|
||||
EXPOSE 5000
|
||||
ENTRYPOINT [ "/app/entry.sh" ]
|
||||
ENTRYPOINT [ "/app/cryptgeon" ]
|
||||
|
@ -4,9 +4,16 @@ use redis::Commands;
|
||||
use crate::note::now;
|
||||
use crate::note::Note;
|
||||
|
||||
lazy_static! {
|
||||
static ref REDIS_CLIENT: String = std::env::var("REDIS")
|
||||
.unwrap_or("redis://127.0.0.1/".to_string())
|
||||
.parse()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
fn get_connection() -> Result<redis::Connection, &'static str> {
|
||||
let client =
|
||||
redis::Client::open("redis://127.0.0.1/").map_err(|_| "Unable to connect to redis")?;
|
||||
redis::Client::open(REDIS_CLIENT.to_string()).map_err(|_| "Unable to connect to redis")?;
|
||||
client
|
||||
.get_connection()
|
||||
.map_err(|_| "Unable to connect to redis")
|
||||
|
Loading…
x
Reference in New Issue
Block a user