diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2c4918c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +/target +*.db diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..23dfbd3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM rust:1.72-alpine as builder +RUN apk add --no-cache musl-dev +WORKDIR /usr/src/app +COPY . . +RUN cargo install --path . --target x86_64-unknown-linux-musl + +FROM alpine:latest +WORKDIR /guoql +COPY --from=builder /usr/local/cargo/bin/guoql /guoql/guoql +CMD ["./guoql", "./guoql.db", "--host", "0.0.0.0"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7903f32 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +version: "3" +services: + guoql: + build: . + ports: + - "8080:8080" + volumes: + - ./guoql.db:/guoql/guoql.db diff --git a/flake.nix b/flake.nix index 8b42e84..f656b51 100644 --- a/flake.nix +++ b/flake.nix @@ -29,10 +29,13 @@ fenixPkgs = fenix.packages.${system}; pkgs = nixpkgs.legacyPackages.${system}; - toolchain = fenixPkgs.stable.withComponents [ - "cargo" - "clippy" - "rustc" + toolchain = fenixPkgs.combine [ + fenixPkgs.stable.cargo + fenixPkgs.stable.clippy + fenixPkgs.stable.rustc + fenixPkgs.stable.rustfmt + fenixPkgs.stable.rust-std + fenixPkgs.targets.x86_64-unknown-linux-musl.stable.rust-std ]; craneLib = crane.lib.${system}.overrideToolchain toolchain; in @@ -60,12 +63,7 @@ devShells.default = pkgs.mkShell { packages = [ - (fenixPkgs.complete.withComponents [ - "cargo" - "clippy" - "rustc" - "rustfmt" - ]) + toolchain fenixPkgs.rust-analyzer pkgs.cargo-expand pkgs.cargo-bloat