Skip to content

Commit

Permalink
Merge pull request #791 from davidgiven/docker
Browse files Browse the repository at this point in the history
Make work on Debian 11.
  • Loading branch information
davidgiven authored Nov 9, 2024
2 parents e14da81 + a736e1d commit b6b28c8
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
wsl --set-default-version 2
wsl --import fedora fedora install.tar.gz
wsl --set-default fedora
wsl sh -c 'dnf -y install https://github.com/rpmsphere/noarch/raw/master/r/rpmsphere-release-38-1.noarch.rpm'
wsl sh -c 'dnf -y install https://github.com/rpmsphere/noarch/raw/master/r/rpmsphere-release-40-1.noarch.rpm'
wsl sh -c 'dnf -y install --setop=install_weak_deps=False gcc gcc-c++ protobuf-c-compiler protobuf-devel fmt-devel systemd-devel sqlite-devel wxGTK-devel mingw32-gcc mingw32-gcc-c++ mingw32-zlib-static mingw32-protobuf-static mingw32-sqlite-static mingw32-wxWidgets3-static mingw32-libpng-static mingw32-libjpeg-static mingw32-libtiff-static mingw32-nsis png2ico'
- name: fix line endings
Expand Down
35 changes: 34 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
BUILDTYPE ?= host
ifeq ($(BUILDTYPE),)
buildtype_Darwin = osx
buildtype_Haiku = haiku
BUILDTYPE := $(buildtype_$(shell uname -s ))
ifeq ($(BUILDTYPE),)
BUILDTYPE := unix
endif
endif
export BUILDTYPE

ifeq ($(BUILDTYPE),windows)
Expand All @@ -23,6 +30,11 @@ else
LDFLAGS =
AR = ar
PKG_CONFIG = pkg-config
ifeq ($(BUILDTYPE),osx)
else
LDFLAGS += -pthread -Wl,--no-as-needed
endif

endif

HOSTCC = gcc
Expand Down Expand Up @@ -94,3 +106,24 @@ install-bin:
$(hide) install -D -v "$(OBJ)/tools+upgrade-flux-file/tools+upgrade-flux-file" "$(DESTDIR)$(BINDIR)/upgrade-flux-file"

include build/ab.mk

DOCKERFILES = \
debian11 \
debian12

define run-docker
docker build -t $1 -f tests/docker/Dockerfile.$(strip $1) .
docker run \
--device=/dev/kvm \
--rm \
--attach STDOUT \
--attach STDERR \
$1 \
make

endef

.PHONY: dockertests
dockertests:
$(hide) echo DOCKERTESTS
$(foreach f,$(DOCKERFILES), $(call run-docker, $f))
3 changes: 1 addition & 2 deletions lib/data/sector.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ struct fmt::formatter<Sector::Status> : formatter<string_view>
{
auto format(Sector::Status status, format_context& ctx) const
{
return formatter<string_view>::format(
Sector::statusToString(status), ctx);
return format_to(ctx.out(), "{}", Sector::statusToString(status));
}
};

Expand Down
31 changes: 31 additions & 0 deletions tests/docker/Dockerfile.debian11
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM debian:11

RUN apt-get update
RUN apt install -y python3 make xz-utils python3 python3-hamcrest \
protobuf-compiler libprotobuf-dev libsqlite3-dev \
libfmt-dev libprotobuf-dev wx-common pkg-config \
libudev-dev g++ libwxgtk3.0-gtk3-dev

RUN useradd app
RUN mkdir -p /home/app
RUN chown app /home/app
USER app
WORKDIR /home/app

COPY --chown=app:app arch arch
COPY --chown=app:app build build
COPY --chown=app:app dep dep
COPY --chown=app:app doc doc
COPY --chown=app:app extras extras
COPY --chown=app:app lib lib
COPY --chown=app:app scripts scripts
COPY --chown=app:app src src
COPY --chown=app:app tests tests
COPY --chown=app:app tools tools
COPY --chown=app:app Makefile .
COPY --chown=app:app build.py .
COPY --chown=app:app config.py .
COPY --chown=app:app protocol.h .
COPY --chown=app:app README.md .


31 changes: 31 additions & 0 deletions tests/docker/Dockerfile.debian12
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM debian:12

RUN apt-get update
RUN apt install -y python3 make xz-utils python3 python3-hamcrest \
protobuf-compiler libprotobuf-dev libsqlite3-dev \
libfmt-dev libprotobuf-dev wx-common pkg-config \
libudev-dev g++ libwxgtk3.2-dev

RUN useradd app
RUN mkdir -p /home/app
RUN chown app /home/app
USER app
WORKDIR /home/app

COPY --chown=app:app arch arch
COPY --chown=app:app build build
COPY --chown=app:app dep dep
COPY --chown=app:app doc doc
COPY --chown=app:app extras extras
COPY --chown=app:app lib lib
COPY --chown=app:app scripts scripts
COPY --chown=app:app src src
COPY --chown=app:app tests tests
COPY --chown=app:app tools tools
COPY --chown=app:app Makefile .
COPY --chown=app:app build.py .
COPY --chown=app:app config.py .
COPY --chown=app:app protocol.h .
COPY --chown=app:app README.md .


0 comments on commit b6b28c8

Please sign in to comment.