mirror of
https://github.com/garentyler/inferno.git
synced 2025-07-19 11:50:41 -06:00
Add server dockerfiles
This commit is contained in:
parent
37bf75649d
commit
31ed9a08a9
7
.dockerignore
Normal file
7
.dockerignore
Normal file
@ -0,0 +1,7 @@
|
||||
.DS_Store
|
||||
._*
|
||||
target
|
||||
*.log
|
||||
logs
|
||||
inferno.toml
|
||||
node_modules
|
12
.github/workflows/clippy.yml
vendored
12
.github/workflows/clippy.yml
vendored
@ -1,12 +0,0 @@
|
||||
on: [push]
|
||||
name: Clippy
|
||||
# Fail on all warnings, including clippy lints.
|
||||
env:
|
||||
RUSTFLAGS: "-Dwarnings"
|
||||
jobs:
|
||||
clippy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Run Clippy
|
||||
run: cargo clippy --all-targets --all-features
|
@ -2,3 +2,4 @@
|
||||
Inferno is a decentralized alternative to Discord.
|
||||
Inferno is licensed under GPLv3.
|
||||
|
||||
Dockerfiles linted using [hadolint](https://github.com/hadolint/hadolint).
|
||||
|
11
docker-compose.yml
Normal file
11
docker-compose.yml
Normal file
@ -0,0 +1,11 @@
|
||||
services:
|
||||
server:
|
||||
restart: unless-stopped
|
||||
build:
|
||||
context: ./server/
|
||||
dockerfile: dev.Dockerfile
|
||||
ports:
|
||||
- "3001:3001"
|
||||
volumes:
|
||||
- ./server:/app
|
||||
- .git:/app/.git
|
7
server/dev.Dockerfile
Normal file
7
server/dev.Dockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
FROM rust:1.82.0-alpine3.20
|
||||
RUN apk add --no-cache musl-dev=1.2.5-r0 git=2.45.2-r0
|
||||
RUN cargo install cargo-watch --locked --version 8.5.3
|
||||
WORKDIR /app
|
||||
RUN git config --global --add safe.directory /app
|
||||
EXPOSE 3001
|
||||
CMD ["cargo", "watch", "-x", "run"]
|
27
server/prod.Dockerfile
Normal file
27
server/prod.Dockerfile
Normal file
@ -0,0 +1,27 @@
|
||||
# Build from /, not /server.
|
||||
# Use cargo chef to cache built dependencies.
|
||||
FROM rust:1.82.0-alpine3.20 AS chef
|
||||
RUN apk add --no-cache musl-dev=1.2.5-r0 git=2.45.2-r0
|
||||
RUN cargo install cargo-chef --locked --version 0.1.68
|
||||
WORKDIR /app
|
||||
RUN git config --global --add safe.directory /app
|
||||
|
||||
FROM chef AS planner
|
||||
COPY server/Cargo.toml .
|
||||
COPY server/Cargo.lock .
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
FROM chef AS builder
|
||||
COPY --from=planner /app/recipe.json recipe.json
|
||||
RUN cargo chef cook --release --recipe-path recipe.json
|
||||
COPY server .
|
||||
COPY .git .git
|
||||
RUN cargo build --release
|
||||
RUN strip target/release/inferno
|
||||
|
||||
# Multi-stage build to minimize container size
|
||||
FROM alpine:3.20
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/target/release/inferno .
|
||||
EXPOSE 3001
|
||||
CMD ["/app/inferno"]
|
Loading…
x
Reference in New Issue
Block a user