docker: widen build context to repo root for build-time install stage

The Dockerfile will need access to chatmaild/ and cmdeploy/ source
trees to run CMDEPLOY_STAGES=install via pyinfra during image build,
moving install-time work out of container startup. The previous context
(./docker) only included helper scripts.

Also adds .dockerignore to exclude .git, data/, venv/ etc. from the
build context, and updates COPY paths accordingly.
This commit is contained in:
j4n
2026-02-13 15:03:04 +01:00
parent e20256c484
commit e5ba9f9d03
3 changed files with 13 additions and 6 deletions

7
.dockerignore Normal file
View File

@@ -0,0 +1,7 @@
.git
data/
venv/
__pycache__
*.pyc
*.orig
.pytest_cache

View File

@@ -1,8 +1,8 @@
services: services:
chatmail: chatmail:
build: build:
context: ./docker context: ./
dockerfile: chatmail_relay.dockerfile dockerfile: docker/chatmail_relay.dockerfile
tags: tags:
- chatmail-relay:latest - chatmail-relay:latest
image: chatmail-relay:latest image: chatmail-relay:latest

View File

@@ -55,12 +55,12 @@ RUN apt-get update && \
WORKDIR /opt/chatmail WORKDIR /opt/chatmail
ARG SETUP_CHATMAIL_SERVICE_PATH=/lib/systemd/system/setup_chatmail.service ARG SETUP_CHATMAIL_SERVICE_PATH=/lib/systemd/system/setup_chatmail.service
COPY ./files/setup_chatmail.service "$SETUP_CHATMAIL_SERVICE_PATH" COPY ./docker/files/setup_chatmail.service "$SETUP_CHATMAIL_SERVICE_PATH"
RUN ln -sf "$SETUP_CHATMAIL_SERVICE_PATH" "/etc/systemd/system/multi-user.target.wants/setup_chatmail.service" RUN ln -sf "$SETUP_CHATMAIL_SERVICE_PATH" "/etc/systemd/system/multi-user.target.wants/setup_chatmail.service"
COPY --chmod=555 ./files/setup_chatmail_docker.sh /setup_chatmail_docker.sh COPY --chmod=555 ./docker/files/setup_chatmail_docker.sh /setup_chatmail_docker.sh
COPY --chmod=555 ./files/update_ini.sh /update_ini.sh COPY --chmod=555 ./docker/files/update_ini.sh /update_ini.sh
COPY --chmod=555 ./files/entrypoint.sh /entrypoint.sh COPY --chmod=555 ./docker/files/entrypoint.sh /entrypoint.sh
## TODO: add git clone. ## TODO: add git clone.
## Problem: how correct save only required files inside container.... ## Problem: how correct save only required files inside container....