OCPP 프록시를 Docker로 통합
This commit is contained in:
10
Dockerfile.proxy
Executable file
10
Dockerfile.proxy
Executable file
@@ -0,0 +1,10 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
WORKDIR /code
|
||||
|
||||
RUN pip install --no-cache-dir websockets aiohttp
|
||||
|
||||
COPY entrypoint-proxy.sh /code/
|
||||
RUN chmod +x /code/entrypoint-proxy.sh
|
||||
|
||||
CMD ["/code/entrypoint-proxy.sh"]
|
||||
@@ -1,5 +1,3 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
# ── FastAPI 백엔드 ──
|
||||
api:
|
||||
@@ -22,6 +20,24 @@ services:
|
||||
networks:
|
||||
- ev-net
|
||||
|
||||
# ── OCPP 프록시 서버 ──
|
||||
proxy:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.proxy
|
||||
container_name: ev-proxy
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "9002:9002"
|
||||
- "9003:9003"
|
||||
volumes:
|
||||
- ./ocpp_proxy_server.py:/code/ocpp_proxy_server.py:ro
|
||||
- ./proxy_control.html:/code/proxy_control.html:ro
|
||||
- proxy_logs:/code/ocpp_logs
|
||||
- proxy_config:/code/config
|
||||
networks:
|
||||
- ev-net
|
||||
|
||||
# ── PostgreSQL ──
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
@@ -60,6 +76,8 @@ services:
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
proxy_logs:
|
||||
proxy_config:
|
||||
|
||||
networks:
|
||||
ev-net:
|
||||
|
||||
24
entrypoint-proxy.sh
Executable file
24
entrypoint-proxy.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 설정 파일을 영구 볼륨에서 관리
|
||||
CONFIG_DIR=/code/config
|
||||
|
||||
# proxy_config.json 심링크
|
||||
if [ -f "$CONFIG_DIR/proxy_config.json" ]; then
|
||||
ln -sf $CONFIG_DIR/proxy_config.json /code/proxy_config.json
|
||||
else
|
||||
touch /code/proxy_config.json
|
||||
cp /code/proxy_config.json $CONFIG_DIR/proxy_config.json 2>/dev/null || true
|
||||
ln -sf $CONFIG_DIR/proxy_config.json /code/proxy_config.json
|
||||
fi
|
||||
|
||||
# proxy_users.json 심링크
|
||||
if [ -f "$CONFIG_DIR/proxy_users.json" ]; then
|
||||
ln -sf $CONFIG_DIR/proxy_users.json /code/proxy_users.json
|
||||
else
|
||||
touch /code/proxy_users.json
|
||||
cp /code/proxy_users.json $CONFIG_DIR/proxy_users.json 2>/dev/null || true
|
||||
ln -sf $CONFIG_DIR/proxy_users.json /code/proxy_users.json
|
||||
fi
|
||||
|
||||
exec python3 ocpp_proxy_server.py
|
||||
Reference in New Issue
Block a user