Skip to content

Commit a1a664e

Browse files
author
J-A Neyret
committed
Now chargepoint simulation is dockerized.
Now launcher is as well dockerized.
1 parent 1367506 commit a1a664e

File tree

3 files changed

+39
-5
lines changed

3 files changed

+39
-5
lines changed

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM debian:bullseye-slim AS open-ocpp-simu
1+
FROM debian:bullseye-slim AS open-ocpp-simu-compile
22

33
SHELL ["/bin/bash", "-c"]
44

docker/Dockerfile_cp_simulator

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM open-ocpp-simu-compile
2+
3+
ARG simu_user=cp_simu
4+
ARG simu_group=cp_simu
5+
ARG simu_uid=1001
6+
ARG simu_gid=1001
7+
8+
USER root
9+
# Ensure user exist within container with same uid/gid
10+
RUN groupadd -g ${simu_gid} ${simu_group} && useradd -m -u ${simu_uid} -g ${simu_gid} ${simu_user}
11+
RUN mkdir -p /var/chargepoint
12+
RUN chown ${simu_uid}:${simu_gid} /var/chargepoint
13+
COPY gcc_native/config.ini /var/chargepoint/config.ini
14+
RUN chown ${simu_uid}:${simu_gid} /var/chargepoint/config.ini
15+
16+
COPY gcc_native /cp_simulator
17+
18+
USER cp_simu
19+
20+
WORKDIR "/var/chargepoint"
21+
22+
ENTRYPOINT ["/cp_simulator/chargepoint"]

makefile

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ BUILD_TYPE?=Debug
1919
DISABLE_DOCKER?=0
2020

2121

22-
DOCKER_COMPILE_IMAGE=open-ocpp-compile
22+
DOCKER_COMPILE_IMAGE=open-ocpp-simu-compile
2323

2424

2525
# Default target
2626
default: gcc-native
2727

2828
# Silent makefile
29-
.SILENT:
29+
#.SILENT:
3030

3131
# Install prefix
3232
ifneq ($(strip $(INSTALL_PREFIX)),)
@@ -97,7 +97,19 @@ $(CLANG_NATIVE_BUILD_DIR)/Makefile:
9797

9898

9999
DOCKER_BUILD=docker build --build-arg http_proxy="${http_proxy}" --build-arg https_proxy="${https_proxy}" --build-arg no_proxy="${no_proxy}" --build-arg uid=$$(id -u) --build-arg gid=$$(id -g)
100-
docker-build-images:
101-
@${DOCKER_BUILD} -f docker/Dockerfile -t ${DOCKER_COMPILE_IMAGE} $(ROOT_DIR)/docker
100+
DOCKER_SIMULATOR_IMAGE=open-occp-cp-simulator
101+
docker-build-images: docker-build-simu-compile docker-build-cp-simulator
102102

103+
docker-build-simu-compile:
104+
@${DOCKER_BUILD} -f docker/Dockerfile -t $(DOCKER_COMPILE_IMAGE) $(ROOT_DIR)/docker
105+
106+
docker-build-cp-simulator:
107+
@${DOCKER_BUILD} -f docker/Dockerfile_cp_simulator -t $(DOCKER_SIMULATOR_IMAGE) $(ROOT_DIR)/bin/
108+
109+
110+
run-simu:
111+
docker run $(DOCKER_INTERACTIVE) --rm --network=host --name ocpp-simu $(DOCKER_SIMULATOR_IMAGE)
112+
113+
run-launcher:
114+
docker run $(DOCKER_INTERACTIVE) --rm --network=host --name ocpp-launcher --entrypoint /cp_simulator/launcher $(DOCKER_SIMULATOR_IMAGE)
103115

0 commit comments

Comments
 (0)