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

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