From 254c351e7fd040d9e5babad0920f090083facb21 Mon Sep 17 00:00:00 2001 From: Anthony Campolo <12433465+ajcwebdev@users.noreply.github.com> Date: Thu, 26 Dec 2024 22:34:31 -0600 Subject: [PATCH] remove env req --- Dockerfile => .github/Dockerfile | 24 ++++++++++-------------- .github/docker-compose.yml | 16 ++++++++++++++++ .github/docker-entrypoint.sh | 6 ++++++ docker-compose.yml | 19 ------------------- docker-entrypoint.sh | 5 ----- 5 files changed, 32 insertions(+), 38 deletions(-) rename Dockerfile => .github/Dockerfile (69%) create mode 100644 .github/docker-compose.yml create mode 100755 .github/docker-entrypoint.sh delete mode 100644 docker-compose.yml delete mode 100644 docker-entrypoint.sh diff --git a/Dockerfile b/.github/Dockerfile similarity index 69% rename from Dockerfile rename to .github/Dockerfile index d06278d..c951af5 100644 --- a/Dockerfile +++ b/.github/Dockerfile @@ -1,4 +1,4 @@ -# Dockerfile +# .github/Dockerfile # --------------------------------------------------- # 1) Node base image with your usual packages @@ -23,28 +23,26 @@ RUN curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp \ -o /usr/local/bin/yt-dlp && \ chmod a+rx /usr/local/bin/yt-dlp -# Install tsx globally RUN npm install -g tsx -# Copy only package.json and package-lock.json to install dependencies +# Copy package.json and package-lock.json from build context (..) +# (Because of "context: .." in docker-compose.yml) COPY package*.json ./ -# Install Node.js dependencies RUN npm ci -# Copy the application source code (excluding files specified in .dockerignore) +# Copy source code COPY src ./src -COPY docker-entrypoint.sh ./ -# Ensure the entrypoint script is executable +# Copy entrypoint script from .github directory +COPY .github/docker-entrypoint.sh ./ RUN chmod +x /usr/src/app/docker-entrypoint.sh # --------------------------------------------------- # 2) Pull the official Ollama image to copy out `ollama` # --------------------------------------------------- FROM ollama/ollama:latest AS ollama-stage -# The official image puts the `ollama` binary in /bin/ollama (Alpine-based), -# or /usr/local/bin/ollama (Debian-based). We'll see which is correct. +# The official image might have /bin/ollama or /usr/local/bin/ollama # --------------------------------------------------- # 3) Final stage: combine everything @@ -52,12 +50,10 @@ FROM ollama/ollama:latest AS ollama-stage FROM base # COPY from the Ollama stage to your final image: -# (Check *which* path works for your version of the image) +# (Check which path works for your version of the image) COPY --from=ollama-stage /bin/ollama /usr/local/bin/ollama -# or if that fails, try: +# If that fails, try: # COPY --from=ollama-stage /usr/local/bin/ollama /usr/local/bin/ollama -COPY .env .env - ENTRYPOINT ["/usr/src/app/docker-entrypoint.sh"] -CMD ["--help"] +CMD ["--help"] \ No newline at end of file diff --git a/.github/docker-compose.yml b/.github/docker-compose.yml new file mode 100644 index 0000000..4d36c0f --- /dev/null +++ b/.github/docker-compose.yml @@ -0,0 +1,16 @@ +# docker-compose.yml + +version: '3.8' + +services: + autoshow: + # Use the parent directory (..) as the Docker build context + build: + context: .. + dockerfile: .github/Dockerfile + # Mount directories/files from host to container + volumes: + - ../content:/usr/src/app/content + - ../.env:/usr/src/app/.env + stdin_open: true + tty: true \ No newline at end of file diff --git a/.github/docker-entrypoint.sh b/.github/docker-entrypoint.sh new file mode 100755 index 0000000..670f7d6 --- /dev/null +++ b/.github/docker-entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# .github/docker-entrypoint.sh + +# Run the autoshow command with all arguments passed to the container +# exec tsx --env-file=.env --no-warnings --experimental-sqlite src/cli/commander.ts "$@" +exec tsx --no-warnings --experimental-sqlite src/cli/commander.ts "$@" \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 15faa2a..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,19 +0,0 @@ -# docker-compose.yml - -services: - # Main application service - autoshow: - # Build configuration for this service - build: - # Use the current directory as build context - context: . - # Use the Dockerfile in the root directory - dockerfile: Dockerfile - # Mount these directories/files from host to container - volumes: - # Share content directory between host and container - - ./content:/usr/src/app/content - # Mount environment variables file - - ./.env:/usr/src/app/.env - stdin_open: true - tty: true \ No newline at end of file diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh deleted file mode 100644 index b0752c7..0000000 --- a/docker-entrypoint.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -# docker-entrypoint.sh -# Run the autoshow command with all arguments passed to the container -exec tsx --env-file=.env --no-warnings --experimental-sqlite src/cli/commander.ts "$@" \ No newline at end of file