1
0
mirror of https://github.com/djhackersdev/bemanitools.git synced 2024-11-27 16:00:52 +01:00

feat(dev): Add a separate docker dev container

Improve the development experience by providing
an additional docker container that can be started
and used as an interactive development environment.
It provides all the tools and a stable environment
for building (identical to the build container).
This commit is contained in:
icex2 2024-02-25 09:14:42 +01:00 committed by icex2
parent 5833197b03
commit 6a98ce1f59
3 changed files with 50 additions and 9 deletions

21
Dockerfile.dev Normal file
View File

@ -0,0 +1,21 @@
FROM --platform=amd64 debian:11.6-slim@sha256:f7d141c1ec6af549958a7a2543365a7829c2cdc4476308ec2e182f8a7c59b519
LABEL description="Development environment for bemanitools"
# mingw-w64-gcc has 32-bit and 64-bit toolchains
RUN apt-get update && apt-get install -y --no-install-recommends \
mingw-w64 \
mingw-w64-common \
make \
zip \
git \
clang-format \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install mdformat
RUN mkdir /bemanitools
WORKDIR /bemanitools
ENV SHELL /bin/bash

View File

@ -13,8 +13,10 @@ BUILDDIR ?= build
builddir_docker := $(BUILDDIR)/docker builddir_docker := $(BUILDDIR)/docker
docker_container_name := "bemanitools-build" docker_build_container_name := "bemanitools-build"
docker_image_name := "bemanitools-build:latest" docker_build_image_name := "bemanitools-build:latest"
docker_dev_container_name := "bemanitools-dev"
docker_dev_image_name := "bemanitools-dev:latest"
depdir := $(BUILDDIR)/dep depdir := $(BUILDDIR)/dep
objdir := $(BUILDDIR)/obj objdir := $(BUILDDIR)/obj
@ -41,6 +43,7 @@ FORCE:
.PHONY: \ .PHONY: \
build-docker \ build-docker \
dev-docker \
clean \ clean \
code-format \ code-format \
doc-format \ doc-format \
@ -89,21 +92,38 @@ version:
$(V)echo "$(gitrev)" > version $(V)echo "$(gitrev)" > version
build-docker: build-docker:
$(V)docker rm -f $(docker_container_name) 2> /dev/null || true $(V)docker rm -f $(docker_build_container_name) 2> /dev/null || true
$(V)docker \ $(V)docker \
build \ build \
-t $(docker_image_name) \ -t $(docker_build_image_name) \
-f Dockerfile \ -f Dockerfile.build \
. .
$(V)docker \ $(V)docker \
run \ run \
--volume $(shell pwd):/bemanitools \ --volume $(shell pwd):/bemanitools \
--name $(docker_container_name) \ --name $(docker_build_container_name) \
$(docker_image_name) $(docker_build_image_name)
dev-docker:
$(V)docker rm -f $(docker_dev_container_name) 2> /dev/null || true
$(V)docker \
build \
-t $(docker_dev_image_name) \
-f Dockerfile.dev \
.
$(V)docker \
run \
--interactive \
--tty \
--volume $(shell pwd):/bemanitools \
--name $(docker_dev_container_name) \
$(docker_dev_image_name)
clean-docker: clean-docker:
$(V)docker rm -f $(docker_container_name) || true $(V)docker rm -f $(docker_dev_container_name) || true
$(V)docker image rm -f $(docker_image_name) || true $(V)docker image rm -f $(docker_dev_image_name) || true
$(V)docker rm -f $(docker_build_container_name) || true
$(V)docker image rm -f $(docker_build_image_name) || true
$(V)rm -rf $(BUILDDIR) $(V)rm -rf $(BUILDDIR)
# #