From ac63fd834961891103b244cefecf223494d8add6 Mon Sep 17 00:00:00 2001 From: Paul Mathieu Date: Sun, 25 Aug 2024 09:18:22 +0200 Subject: [PATCH] server: add devcontainer --- skycraft/server/Dockerfile | 14 ++++++++++++++ skycraft/server/Makefile | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 skycraft/server/Dockerfile create mode 100644 skycraft/server/Makefile diff --git a/skycraft/server/Dockerfile b/skycraft/server/Dockerfile new file mode 100644 index 0000000..12dee36 --- /dev/null +++ b/skycraft/server/Dockerfile @@ -0,0 +1,14 @@ +FROM rust:1.80.1 AS build + +RUN apt-get update && apt-get install -y lld + +WORKDIR /workspace + +COPY src /workspace/src +COPY Cargo.toml /workspace/ +COPY Cargo.lock /workspace/ + +RUN cargo build + + +FROM build AS dev diff --git a/skycraft/server/Makefile b/skycraft/server/Makefile new file mode 100644 index 0000000..a9d3af0 --- /dev/null +++ b/skycraft/server/Makefile @@ -0,0 +1,19 @@ +dev-image: + docker build -t cargo-server-dev --target dev . + +.PHONY: dev +dev: dev-image ## Start a dev container + docker run -it --rm \ + -v $(CURDIR)/src:/workspace/src \ + -v $(CURDIR)/Cargo.toml:/workspace/Cargo.toml \ + -v $(CURDIR)/Cargo.lock:/workspace/Cargo.lock \ + -p 127.0.0.1:8080:8080 \ + cargo-server-dev \ + bash + + +.PHONY: help +help: ## Show this help + @echo Noteworthy targets: + @egrep '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' +.DEFAULT_GOAL := help