Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
c23d2dc50b | |||
46dbd88d91 | |||
f0f484288e | |||
90d39b121f |
@ -3,7 +3,7 @@ name = "libreddit"
|
|||||||
description = " Alternative private front-end to Reddit"
|
description = " Alternative private front-end to Reddit"
|
||||||
license = "AGPL-3.0"
|
license = "AGPL-3.0"
|
||||||
repository = "https://github.com/spikecodes/libreddit"
|
repository = "https://github.com/spikecodes/libreddit"
|
||||||
version = "0.8.2"
|
version = "0.8.4"
|
||||||
authors = ["spikecodes <19519553+spikecodes@users.noreply.github.com>"]
|
authors = ["spikecodes <19519553+spikecodes@users.noreply.github.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
14
Dockerfile
14
Dockerfile
@ -1,17 +1,15 @@
|
|||||||
FROM rust:latest as builder
|
FROM rust:alpine as builder
|
||||||
|
|
||||||
WORKDIR /usr/src/libreddit
|
WORKDIR /usr/src/libreddit
|
||||||
COPY . .
|
COPY . .
|
||||||
|
RUN apk add --no-cache g++
|
||||||
RUN cargo install --path .
|
RUN cargo install --path .
|
||||||
|
|
||||||
|
FROM alpine:latest
|
||||||
FROM debian:buster-slim
|
RUN apk add --no-cache curl
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y libcurl4 && rm -rf /var/lib/apt/lists/*
|
|
||||||
COPY --from=builder /usr/local/cargo/bin/libreddit /usr/local/bin/libreddit
|
COPY --from=builder /usr/local/cargo/bin/libreddit /usr/local/bin/libreddit
|
||||||
RUN useradd --system --user-group --home-dir /nonexistent --no-create-home --shell /usr/sbin/nologin libreddit
|
RUN adduser --system --home /nonexistent --no-create-home --disabled-password libreddit
|
||||||
USER libreddit
|
USER libreddit
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
HEALTHCHECK --interval=5m --timeout=3s CMD curl -f http://localhost:8080/settings || exit 1
|
||||||
|
|
||||||
CMD ["libreddit"]
|
CMD ["libreddit"]
|
13
docker-compose.yml
Normal file
13
docker-compose.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
build: .
|
||||||
|
restart: always
|
||||||
|
container_name: "libreddit"
|
||||||
|
ports:
|
||||||
|
- 8080:8080
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "http://localhost:8080/settings"]
|
||||||
|
interval: 5m
|
||||||
|
timeout: 3s
|
@ -171,9 +171,9 @@ impl Server {
|
|||||||
parammed.set_params(found.params().to_owned());
|
parammed.set_params(found.params().to_owned());
|
||||||
|
|
||||||
// Run the route's function
|
// Run the route's function
|
||||||
let yeet = (found.handler().to_owned().to_owned())(parammed);
|
let func = (found.handler().to_owned().to_owned())(parammed);
|
||||||
async move {
|
async move {
|
||||||
let res: Result<Response<Body>, String> = yeet.await;
|
let res: Result<Response<Body>, String> = func.await;
|
||||||
// Add default headers to response
|
// Add default headers to response
|
||||||
res.map(|mut response| {
|
res.map(|mut response| {
|
||||||
response.headers_mut().extend(headers);
|
response.headers_mut().extend(headers);
|
||||||
|
Reference in New Issue
Block a user