Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

Commit

Permalink
feat: docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
Wybxc committed Sep 1, 2023
1 parent 0346d9b commit fdfc208
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
*.db
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "3"
services:
guoql:
build: .
ports:
- "8080:8080"
volumes:
- ./guoql.db:/guoql/guoql.db
18 changes: 8 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fdfc208

Please sign in to comment.