2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-01-19 01:43:06 +00:00

Update initial containerfile to use official base debian image and work over network

This commit is contained in:
Wookey
2025-07-17 01:43:29 +01:00
parent 14222dd3fc
commit a2356d9559

View File

@@ -1,46 +1,71 @@
# Containerfile originally created by MS Copilot 1st July 2025
# hand edited Philip Sargent
# move this to the directory above troggle, loser etc before running it.
# create an oci container image with
# cd /home/expo && podman build -t expo:dev --rm -f troggle/Containerfile
#
FROM ghcr.io/astral-sh/uv:python3.13-bookworm
WORKDIR /EXPO
FROM docker.io/library/debian:bookworm
WORKDIR /home/expo2
USER root
RUN apt update && \
apt-get install sqlite3 survex rsync -y && \
useradd -m expopod -G sudo -s /bin/bash
apt install -y postgresql apache2 survex rsync git cgit proftpd && \
python3 python3-django python3-pil python3-piexif && \
python3-bs4 python3-unidecode python3-cryptography && \
libjs-codemirror libjs-proj4
# do we need libjs-leaflet? libjs-sizzle? libjs-mgrs?
# Install non-packaged dependencies
# apt install CaveView and bins and from local repo
# Copy only the dependency files first
COPY troggle/pyproject.toml troggle/uv.lock ./troggle/
#wget troggle/pyproject.toml troggle/uv.lock
#RUN wget troggle/pyproject.toml && uv sync --frozen
COPY expofiles/surveyscans/2018 /EXPO/expofiles/surveyscans/2018
COPY expofiles/photos/2018/PhilipSargent/ /EXPO/expofiles/photos/2018/PhilipSargent
COPY troggle /EXPO/troggle
COPY expoweb /EXPO/expoweb
COPY loser /EXPO/loser
COPY drawings /EXPO/drawings
RUN chown -R expopod:expopod .
USER expopod
RUN useradd -m expo -G sudo -s /bin/bash
# Install dependencies and Django
RUN cd troggle && uv sync --frozen
# Optional:install and configure BoE
RUN git config --global user.email "expopod@potato.hut"
RUN git config --global user.name "expopod"
#add apache config, enable modules
#configure postgres
#Start up services for apache, proftpd, postgresql, cron?
#end of system stage
# User files - separate layer?
RUN chown expo:expo .
USER expo
RUN mkdir -p repositories/git && cd repositories/git && \
git clone http://expo.survex.com/repositories/troggle/.git && \
git clone http://expo.survex.com/repositories/expoweb/.git && \
git clone http://expo.survex.com/repositories/loser/.git && \
git clone http://expo.survex.com/repositories/drawings/.git
RUN ln -s repositories/git/troggle troggle && \
ln -s repositories/git/troggle expoweb && \
ln -s repositories/git/troggle loser && \
ln -s repositories/git/troggle drawings
RUN git config --global user.email "expo@potato.hut"
RUN git config --global user.name "expo"
RUN git config --global pull.rebase true
RUN cd troggle && uv run databaseReset.py reset INIT
#rsync -az expo.survex.com:expofiles expofiles
#demo short version
#rsync -az expo.survex.com:expofiles/surveyscans/2018 expofiles/surveyscans/2018
#rsync -az expo.survex.com:expofiles/photos/2018/PhilipSargent/ expofiles/photos/2018/PhilipSargent
#/bin/sh is missing at this point - why?
RUN cd troggle && run databaseReset.py reset INIT
EXPOSE 8080
#Run postres process
CMD ["uv", "run", "python", "troggle/manage.py", "runserver", "0.0.0.0:8080"]
CMD ["bash"]
# move this file to the directory above troggle, loser etc before running the podman image build command.
# if this was used like this:
# podman image build . --tag expo-01
# run this image interactively with
# podman run -it --network=host --rm expo-01
# used image with:
# podman run -it --network=host --rm expo:dev