Skip to content

Commit

Permalink
chore: add linux-env makefile target
Browse files Browse the repository at this point in the history
  • Loading branch information
vfusco committed Feb 8, 2024
1 parent 12b0f65 commit 9c1896d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ ARG EMULATOR_REPOSITORY=cartesi/machine-emulator
ARG EMULATOR_TAG=0.16.0
ARG RELEASE=yes

FROM --platform=$TARGETPLATFORM ${EMULATOR_REPOSITORY}:${EMULATOR_TAG} as dep-builder
FROM --platform=$TARGETPLATFORM ${EMULATOR_REPOSITORY}:${EMULATOR_TAG} as linux-env

USER root

RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" apt-get install --no-install-recommends -y \
build-essential wget git \
build-essential wget git procps \
libreadline-dev libboost-coroutine1.81-dev libboost-context1.81-dev \
libboost-filesystem1.81-dev libboost-log1.81-dev libssl-dev libc-ares-dev zlib1g-dev \
ca-certificates automake libtool patchelf cmake pkg-config lua5.4 liblua5.4-dev \
Expand All @@ -20,7 +20,7 @@ RUN apt-get update && \

WORKDIR /usr/src/server-manager

FROM --platform=$TARGETPLATFORM dep-builder as builder
FROM --platform=$TARGETPLATFORM linux-env as builder

COPY . .

Expand Down
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,30 @@ source-default: | $(SERVER_MANAGER_PROTO) checksum
image:
docker build -t cartesi/server-manager:$(TAG) -f Dockerfile --build-arg EMULATOR_REPOSITORY=$(EMULATOR_REPOSITORY) --build-arg EMULATOR_TAG=$(EMULATOR_TAG) .

linux-env-stage-image:
docker build --target linux-env -t cartesi/server-manager:linux-env -f Dockerfile --build-arg EMULATOR_REPOSITORY=$(EMULATOR_REPOSITORY) --build-arg EMULATOR_TAG=$(EMULATOR_TAG) .

installer-stage-image:
docker build --target installer -t cartesi/server-manager:installer -f Dockerfile --build-arg EMULATOR_REPOSITORY=$(EMULATOR_REPOSITORY) --build-arg EMULATOR_TAG=$(EMULATOR_TAG) .

check-linux-env:
@if docker images $(DOCKER_PLATFORM) -q cartesi/server-manager:linux-env 2>/dev/null | grep -q .; then \
echo "Docker image cartesi/server-manager:linux-env exists"; \
else \
echo "Docker image cartesi/server-manager:linux-env does not exist. Creating:"; \
$(MAKE) linux-env-stage-image; \
fi

linux-env: check-linux-env
@docker run $(DOCKER_PLATFORM) --hostname linux-env -it --rm \
-e USER=$$(id -u -n) \
-e GROUP=$$(id -g -n) \
-e UID=$$(id -u) \
-e GID=$$(id -g) \
-v `pwd`:/usr/src/server-manager \
-w /usr/src/server-manager \
cartesi/server-manager:linux-env /bin/bash

$(SUBCLEAN): %.clean:
$(MAKE) -C $* clean

Expand Down

0 comments on commit 9c1896d

Please sign in to comment.