Test_commit of the entrypoint solution with dockerfile
This commit is contained in:
parent
34c9d4c1a1
commit
e253c54adb
13
Dockerfile
Normal file
13
Dockerfile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Use the existing Odoo image as the base
|
||||||
|
FROM odoo:latest AS odoo-custom
|
||||||
|
|
||||||
|
# Copy the entrypoint script into the container
|
||||||
|
COPY entrypoint_odoo.sh /usr/local/bin/entrypoint_odoo.sh
|
||||||
|
|
||||||
|
USER root
|
||||||
|
|
||||||
|
# Make the entrypoint script executable
|
||||||
|
RUN chmod +x /usr/local/bin/entrypoint_odoo.sh
|
||||||
|
|
||||||
|
# Set the new entrypoint
|
||||||
|
ENTRYPOINT ["/usr/local/bin/entrypoint_odoo.sh"]
|
49
__main__.py
49
__main__.py
@ -58,29 +58,44 @@ for container in containers_data.get("containers", []):
|
|||||||
|
|
||||||
# Create the container
|
# Create the container
|
||||||
try:
|
try:
|
||||||
container_resource = docker.Container(
|
if container["name"] == "odoo": # Special configuration for Odoo
|
||||||
container_name,
|
container_resource = docker.Container(
|
||||||
image=container["image"],
|
container_name,
|
||||||
envs=[
|
image="odoo-custom", # Replace with pre-built image name
|
||||||
f"{key}={value}" for key, value in container.get("envs", {}).items()
|
envs=[f"{key}={value}" for key, value in container.get("envs", {}).items()],
|
||||||
] if "envs" in container else [],
|
ports=[
|
||||||
ports=[
|
docker.ContainerPortArgs(
|
||||||
docker.ContainerPortArgs(
|
internal=port["internal"],
|
||||||
internal=port["internal"],
|
external=port["external"] + i
|
||||||
external=port["external"] + i
|
) for port in container.get("ports", [])
|
||||||
) for port in container.get("ports", [])
|
] if "ports" in container else [],
|
||||||
] if "ports" in container else [],
|
volumes=volumes_config,
|
||||||
volumes=volumes_config,
|
network_mode=network.name if network else None,
|
||||||
network_mode=network.name if network else None,
|
)
|
||||||
command=container.get("command", []),
|
else:
|
||||||
)
|
container_resource = docker.Container(
|
||||||
|
container_name,
|
||||||
|
image=container["image"],
|
||||||
|
envs=[
|
||||||
|
f"{key}={value}" for key, value in container.get("envs", {}).items()
|
||||||
|
] if "envs" in container else [],
|
||||||
|
ports=[
|
||||||
|
docker.ContainerPortArgs(
|
||||||
|
internal=port["internal"],
|
||||||
|
external=port["external"] + i
|
||||||
|
) for port in container.get("ports", [])
|
||||||
|
] if "ports" in container else [],
|
||||||
|
volumes=volumes_config,
|
||||||
|
network_mode=network.name if network else None,
|
||||||
|
command=container.get("command", []),
|
||||||
|
)
|
||||||
ports = container.get("ports", [])
|
ports = container.get("ports", [])
|
||||||
if ports:
|
if ports:
|
||||||
for port in ports:
|
for port in ports:
|
||||||
external_port = port["external"] + i
|
external_port = port["external"] + i
|
||||||
pulumi.export(
|
pulumi.export(
|
||||||
f"{container_name}_url",
|
f"{container_name}_url",
|
||||||
f"http://localhost:{external_port}"
|
f"http://localhost:{external_port}"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pulumi.log.error(f"Failed to create container {container_name}: {e}")
|
pulumi.log.error(f"Failed to create container {container_name}: {e}")
|
||||||
|
@ -27,8 +27,7 @@
|
|||||||
"ODOO_PASSWORD": "admin"
|
"ODOO_PASSWORD": "admin"
|
||||||
},
|
},
|
||||||
"ports": [{"internal": 8069, "external": 8069}],
|
"ports": [{"internal": 8069, "external": 8069}],
|
||||||
"instances": 3,
|
"instances": 3
|
||||||
"command": ["/bin/bash", "-c", "sleep 10 && odoo -i base"]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "grafana",
|
"name": "grafana",
|
||||||
|
6
entrypoint_backup.sh
Normal file
6
entrypoint_backup.sh
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -c
|
||||||
|
|
||||||
|
apk add --no-cache postgresql-client
|
||||||
|
sleep 5
|
Loading…
Reference in New Issue
Block a user