From c7158ab969a173dc902a026621845ea860e6890d Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Mon, 25 Dec 2023 20:55:55 +0000 Subject: [PATCH] digital ocean update --- .do/deploy.template.yaml | 2 +- Dockerfile2 | 51 ++++++++++++++++++++++++++++++---------- 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/.do/deploy.template.yaml b/.do/deploy.template.yaml index 2bb1df337..86fb70584 100644 --- a/.do/deploy.template.yaml +++ b/.do/deploy.template.yaml @@ -3,7 +3,7 @@ spec: services: - name: stirling-pdf git: - branch: deployScripts + branch: digitalOcean repo_clone_url: https://github.com/Frooodle/Stirling-PDF.git dockerfile_path: Dockerfile2 envs: diff --git a/Dockerfile2 b/Dockerfile2 index 36ae5eb5d..46e45bc02 100644 --- a/Dockerfile2 +++ b/Dockerfile2 @@ -11,27 +11,54 @@ WORKDIR /downloader RUN curl -s https://api.github.com/repos/Frooodle/Stirling-PDF/releases/latest \ | jq -r ".assets[] | select(.name == \"Stirling-PDF.jar\") | .browser_download_url" \ | xargs curl -L -o Stirling-PDF.jar + + +# Use the base image +FROM frooodle/stirling-pdf-base:version8 +ARG VERSION_TAG -# Production stage -FROM frooodle/stirling-pdf-base:beta4 + +# Set Environment Variables +ENV DOCKER_ENABLE_SECURITY=false \ + HOME=/home/stirlingpdfuser \ + VERSION_TAG=$VERSION_TAG +# PUID=1000 \ +# PGID=1000 \ +# UMASK=022 \ + -# Create scripts folder and copy local scripts -RUN mkdir /scripts +# Create user and group +##RUN groupadd -g $PGID stirlingpdfgroup && \ +## useradd -u $PUID -g stirlingpdfgroup -s /bin/sh stirlingpdfuser && \ +## mkdir -p $HOME && chown stirlingpdfuser:stirlingpdfgroup $HOME + +# Set up necessary directories and permissions +RUN mkdir -p /scripts /usr/share/fonts/opentype/noto /usr/share/tesseract-ocr /configs /customFiles +##&& \ +## chown -R stirlingpdfuser:stirlingpdfgroup /scripts /usr/share/fonts/opentype/noto /usr/share/tesseract-ocr /configs /customFiles && \ +## chown -R stirlingpdfuser:stirlingpdfgroup /usr/share/tesseract-ocr-original + +# Copy necessary files COPY ./scripts/* /scripts/ - -# Install fonts -RUN mkdir /usr/share/fonts/opentype/noto/ COPY src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/ -RUN fc-cache -f -v +COPY src/main/resources/static/fonts/*.otf /usr/share/fonts/opentype/noto/ # Copy the application JAR file from the download stage -COPY --from=downloader /downloader/Stirling-PDF.jar /app.jar +COPY --from=downloader /downloader/*.jar /app.jar -# Expose the application port +# Set font cache and permissions +RUN fc-cache -f -v && chmod +x /scripts/* + +##&& \ +## chown stirlingpdfuser:stirlingpdfgroup /app.jar && \ +## chmod +x /scripts/init.sh + +# Expose necessary ports EXPOSE 8080 -# Run the application -RUN chmod +x /scripts/init.sh +# Set user and run command +##USER stirlingpdfuser ENTRYPOINT ["/scripts/init.sh"] CMD ["java", "-jar", "/app.jar"] +