mirror of https://github.com/kitsune-soc/kitsune
Layered docker images and improved docker-compose deployment (#282)
* update docker compose and add layered docker images for kitsune and kitsune-search-server * consistent Dockerfiles * use stable in the Dockerfiles
This commit is contained in:
parent
74cc110e82
commit
9861629cc8
|
@ -1,5 +1,4 @@
|
|||
**/node_modules
|
||||
target/
|
||||
kitsune-fe/
|
||||
Dockerfile.dev
|
||||
Dockerfile.prod
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
[cache]
|
||||
type = "in-memory"
|
||||
|
||||
[database]
|
||||
url = "postgres://kitsune:password@db/kitsune"
|
||||
max-connections = 20
|
||||
|
||||
[instance]
|
||||
name = "Kitsune"
|
||||
description = "https://www.youtube.com/watch?v=6lnnPnr_0SU"
|
||||
character-limit = 5000
|
||||
registrations-open = true
|
||||
|
||||
[instance.federation-filter]
|
||||
type = "deny"
|
||||
domains = []
|
||||
|
||||
[job-queue]
|
||||
redis-url = "redis://redis"
|
||||
num-workers = 20
|
||||
|
||||
[messaging]
|
||||
type = "in-process"
|
||||
|
||||
[server]
|
||||
frontend-dir = "./kitsune-fe/dist"
|
||||
max-upload-size = 5242880 # 5MB
|
||||
media-proxy-enabled = false
|
||||
port = 5000
|
||||
prometheus-port = 9000
|
||||
request-timeout-secs = 60
|
||||
|
||||
[search]
|
||||
type = "sql"
|
||||
|
||||
[storage]
|
||||
type = "fs"
|
||||
upload-dir = "./uploads"
|
||||
|
||||
[url]
|
||||
scheme = "http"
|
||||
domain = "localhost:5000"
|
|
@ -3,6 +3,8 @@ version: '3.1'
|
|||
services:
|
||||
backend:
|
||||
image: kitsune
|
||||
command:
|
||||
- config.toml
|
||||
ports:
|
||||
- "5000:5000"
|
||||
networks:
|
||||
|
@ -18,6 +20,13 @@ services:
|
|||
SEARCH_SERVERS: http://backend-search:8080
|
||||
volumes:
|
||||
- upload-data:/app/uploads
|
||||
- type: bind
|
||||
source: ${KITSUNE_CONFIG}
|
||||
target: /app/config.toml
|
||||
read_only: true
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
|
||||
backend-search:
|
||||
image: kitsune-search
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
FROM rust:1-alpine AS build
|
||||
RUN rustup default nightly
|
||||
RUN apk add --no-cache musl-dev
|
||||
COPY . /build
|
||||
WORKDIR /build
|
||||
RUN cargo -Z sparse-registry build
|
||||
FROM rust:1-alpine AS base
|
||||
RUN apk add --no-cache musl-dev make protobuf-dev
|
||||
RUN cargo install cargo-chef
|
||||
WORKDIR app
|
||||
|
||||
FROM base AS planner
|
||||
COPY . .
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
FROM base AS build
|
||||
COPY --from=planner /app/recipe.json recipe.json
|
||||
RUN cargo chef cook --recipe-path recipe.json
|
||||
COPY . .
|
||||
RUN cargo build --bin kitsune-search-server
|
||||
|
||||
FROM alpine:latest
|
||||
WORKDIR /app
|
||||
COPY --from=build /build/target/debug/kitsune-search .
|
||||
CMD ["/app/kitsune-search"]
|
||||
WORKDIR app
|
||||
COPY --from=build /app/target/debug/kitsune-search-server .
|
||||
ENTRYPOINT ["./kitsune-search-server"]
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
FROM rust:1-alpine AS build
|
||||
RUN rustup default nightly
|
||||
RUN apk add --no-cache musl-dev
|
||||
COPY . /build
|
||||
WORKDIR /build
|
||||
RUN cargo -Z sparse-registry build --release
|
||||
FROM rust:1-alpine AS base
|
||||
RUN apk add --no-cache musl-dev make protobuf-dev
|
||||
RUN cargo install cargo-chef
|
||||
WORKDIR app
|
||||
|
||||
FROM base AS planner
|
||||
COPY . .
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
FROM base AS build
|
||||
COPY --from=planner /app/recipe.json recipe.json
|
||||
RUN cargo chef cook --release --recipe-path recipe.json
|
||||
COPY . .
|
||||
RUN cargo build --release --bin kitsune-search-server
|
||||
|
||||
FROM alpine:latest
|
||||
WORKDIR /app
|
||||
COPY --from=build /build/target/release/kitsune-search .
|
||||
CMD ["/app/kitsune-search"]
|
||||
WORKDIR app
|
||||
COPY --from=build /app/target/release/kitsune-search-server .
|
||||
ENTRYPOINT ["./kitsune-search-server"]
|
|
@ -1,11 +1,26 @@
|
|||
FROM rust:1-alpine AS build
|
||||
RUN rustup default nightly
|
||||
RUN apk add --no-cache musl-dev
|
||||
COPY . /build
|
||||
WORKDIR /build
|
||||
RUN cargo -Z sparse-registry build
|
||||
FROM rust:1-alpine AS base
|
||||
RUN apk add --no-cache musl-dev make protobuf-dev
|
||||
RUN cargo install cargo-chef
|
||||
WORKDIR app
|
||||
|
||||
FROM base AS planner
|
||||
COPY . .
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
FROM base AS build
|
||||
COPY --from=planner /app/recipe.json recipe.json
|
||||
RUN cargo chef cook --recipe-path recipe.json
|
||||
COPY . .
|
||||
RUN cargo build --bin kitsune
|
||||
|
||||
FROM base AS frontend
|
||||
RUN apk add --no-cache yarn
|
||||
COPY kitsune-fe .
|
||||
WORKDIR kitsune-fe
|
||||
RUN yarn install && yarn build
|
||||
|
||||
FROM alpine:latest
|
||||
WORKDIR /app
|
||||
COPY --from=build /build/target/debug/kitsune .
|
||||
CMD ["/app/kitsune"]
|
||||
WORKDIR app
|
||||
COPY --from=build /app/target/debug/kitsune .
|
||||
COPY --from=frontend /app kitsune-fe
|
||||
ENTRYPOINT ["./kitsune"]
|
||||
|
|
|
@ -1,11 +1,26 @@
|
|||
FROM rust:1-alpine AS build
|
||||
RUN rustup default nightly
|
||||
RUN apk add --no-cache musl-dev
|
||||
COPY . /build
|
||||
WORKDIR /build
|
||||
RUN cargo -Z sparse-registry build --release
|
||||
FROM rust:1-alpine AS base
|
||||
RUN apk add --no-cache musl-dev make protobuf-dev
|
||||
RUN cargo install cargo-chef
|
||||
WORKDIR app
|
||||
|
||||
FROM base AS planner
|
||||
COPY . .
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
FROM base AS build
|
||||
COPY --from=planner /app/recipe.json recipe.json
|
||||
RUN cargo chef cook --release --recipe-path recipe.json
|
||||
COPY . .
|
||||
RUN cargo build --release --bin kitsune
|
||||
|
||||
FROM base AS frontend
|
||||
RUN apk add --no-cache yarn
|
||||
COPY kitsune-fe .
|
||||
WORKDIR kitsune-fe
|
||||
RUN yarn install && yarn build
|
||||
|
||||
FROM alpine:latest
|
||||
WORKDIR /app
|
||||
COPY --from=build /build/target/release/kitsune .
|
||||
CMD ["/app/kitsune"]
|
||||
WORKDIR app
|
||||
COPY --from=build /app/target/release/kitsune .
|
||||
COPY --from=frontend /app kitsune-fe
|
||||
ENTRYPOINT ["./kitsune"]
|
||||
|
|
Loading…
Reference in New Issue