Update Dockerfile and scripts for v1 layout compatibility, enhancing directory structure and credential handling. Adjust paths for executable and storage, and improve README documentation to reflect changes.

This commit is contained in:
2026-03-19 21:56:46 -04:00
parent fa2029b1cb
commit 2dee620e36
6 changed files with 111 additions and 36 deletions
+22 -23
View File
@@ -29,12 +29,12 @@ RUN make
# Stage 2: Runtime stage - Create minimal application container
FROM ubuntu:latest
# Build arguments for configurable credentials and paths
# Build arguments for configurable credentials and paths (v1 VM layout)
ARG SSH_USERNAME=piscaladmin
ARG SSH_PASSWORD=piscaladmin
ARG SSH_GROUP=piscaladmin
ARG STORAGE_PATH=/home/piscaladmin/LeafWeb_storage
ARG PISCAL_EXECUTABLE=/srv/piscal
ARG PISCAL_EXECUTABLE=/home/piscaladmin/piscal_executable/piscal
# Install runtime dependencies only
RUN set -xe \
@@ -67,12 +67,13 @@ RUN set -xe \
RUN set -xe \
&& mkdir /run/sshd
# Ensure the job/workspace base under /srv is writable.
# The client uses `/srv/${PiscalDirectoryName}/input` and `PiscalDirectoryName`
# can itself be prefixed with `LeafWeb/...`.
# v1 VM layout: LeafWeb contains scripts + project directories
# Create LeafWeb (scripts and job dirs), piscal_executable, and storage
RUN set -xe \
&& mkdir -p /srv/LeafWeb \
&& chown -R ${SSH_USERNAME}:${SSH_GROUP} /srv/LeafWeb
&& mkdir -p /home/${SSH_USERNAME}/LeafWeb \
&& mkdir -p /home/${SSH_USERNAME}/piscal_executable \
&& chown -R ${SSH_USERNAME}:${SSH_GROUP} /home/${SSH_USERNAME}/LeafWeb \
&& chown -R ${SSH_USERNAME}:${SSH_GROUP} /home/${SSH_USERNAME}/piscal_executable
# Create storage directory structure with proper ownership
RUN set -xe \
@@ -80,25 +81,23 @@ RUN set -xe \
&& mkdir -p ${STORAGE_PATH}/output \
&& chown -R ${SSH_USERNAME}:${SSH_GROUP} ${STORAGE_PATH}
# Copy compiled executable from builder stage
COPY --from=builder /build/leafres/testrun/piscal /srv/piscal
# Copy compiled executable and scripts to staging dir (COPY can't use ARG in dest)
COPY --from=builder /build/leafres/testrun/piscal /tmp/piscal
COPY piscal-manager/piscal_launcher.sh piscal-manager/piscal_manager.sh piscal-manager/subdir_year.sh piscal-manager/README.txt /tmp/leafweb/
# Copy piscal-manager scripts (excluding .cfg, we'll generate it)
COPY piscal-manager/*.sh /srv/
COPY piscal-manager/README.txt /srv/
# Generate piscal_launcher.cfg with build-time parameters
# Install to user's home (supports custom SSH_USERNAME)
RUN set -xe \
&& echo "piscal_executable=\"${PISCAL_EXECUTABLE}\"" > /srv/piscal_launcher.cfg \
&& echo "storage_directory=\"${STORAGE_PATH}\"" >> /srv/piscal_launcher.cfg \
&& chown ${SSH_USERNAME}:${SSH_GROUP} /srv/piscal_launcher.cfg
&& cp /tmp/piscal /home/${SSH_USERNAME}/piscal_executable/piscal \
&& chown ${SSH_USERNAME}:${SSH_GROUP} /home/${SSH_USERNAME}/piscal_executable/piscal \
&& cp /tmp/leafweb/* /home/${SSH_USERNAME}/LeafWeb/ \
&& echo "piscal_executable=\"${PISCAL_EXECUTABLE}\"" > /home/${SSH_USERNAME}/LeafWeb/piscal_launcher.cfg \
&& echo "storage_directory=\"${STORAGE_PATH}\"" >> /home/${SSH_USERNAME}/LeafWeb/piscal_launcher.cfg \
&& chown ${SSH_USERNAME}:${SSH_GROUP} /home/${SSH_USERNAME}/LeafWeb/* \
&& find /home/${SSH_USERNAME}/LeafWeb -name "*.sh" -type f -exec sed -i 's/\r$//' {} \; \
&& chmod +x /home/${SSH_USERNAME}/LeafWeb/*.sh || true \
&& rm -rf /tmp/piscal /tmp/leafweb
# Fix Windows line endings (CRLF -> LF) for scripts and make scripts executable
RUN set -xe \
&& find /srv -name "*.sh" -type f -exec sed -i 's/\r$//' {} \; \
&& chmod +x /srv/*.sh || true
WORKDIR /srv
WORKDIR /home/${SSH_USERNAME}/LeafWeb
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]