Add dockerimage for server

This commit is contained in:
Andras Schmelczer 2024-12-18 22:37:13 +00:00
parent 2d5c91a5ef
commit a4d9ec16a1
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
5 changed files with 37 additions and 8 deletions

View file

@ -35,9 +35,24 @@
- add clap
- add auth middleware
- add request logs
- CI for:
- publish reconcile
- cross-platform build server
- run load test on server
- build and publish plugin with openapi types
- build docker image
todo: enable
[workspace.lints.clippy]
single_call_fn = { level = "allow", priority = 1 }
absolute_paths = { level = "allow", priority = 1 }
arithmetic_side_effects = { level = "allow", priority = 1 }
similar_names = { level = "allow", priority = 1 }
self_named_module_files = { level = "allow", priority = 1 }
single_char_lifetime_names = { level = "allow", priority = 1 }
missing_docs_in_private_items = { level = "allow", priority = 1 }
question_mark_used = { level = "allow", priority = 1 }
implicit_return = { level = "allow", priority = 1 }
pedantic = { level = "warn", priority = 0 }
cargo = { level = "warn", priority = 0 }

3
backend/.dockerignore Normal file
View file

@ -0,0 +1,3 @@
target
Dockerfile
.dockerignore

View file

@ -7,13 +7,6 @@ members = [
"sync_lib"
]
[workspace.lints.clippy]
single_call_fn = "allow"
missing_docs_in_private_items = "allow"
question_mark_used = "allow"
implicit_return = "allow"
[workspace.dependencies]
serde = { version = "1.0.214", default-features = false, features = ["derive"] }
thiserror = { version = "1.0.66", default-features = false }
@ -25,3 +18,5 @@ anyhow = { version = "1.0.94", features = ["backtrace"] }
codegen-units = 1
lto = true
opt-level = 3
[workspace.lints.clippy]

16
backend/Dockerfile Normal file
View file

@ -0,0 +1,16 @@
FROM rust:1.83 as builder
WORKDIR /usr/src/backend
RUN apt update && apt install -y musl-tools
RUN rustup target add x86_64-unknown-linux-musl
COPY . .
RUN cargo build --package sync_server --release --target x86_64-unknown-linux-musl
FROM alpine:3.21.0
COPY --from=builder /usr/src/backend/target/x86_64-unknown-linux-musl/release/sync_server /app/sync_server
ENTRYPOINT ["/app/sync_server"]

View file

@ -28,4 +28,4 @@ default = ["console_error_panic_hook"]
wee_alloc = []
[lints]
workspace = true
workspace = true