Skip to content

Instantly share code, notes, and snippets.

@vpnry
Created August 31, 2022 05:56
Show Gist options
  • Select an option

  • Save vpnry/e2411ec23048f1fbd5b17e258bada21c to your computer and use it in GitHub Desktop.

Select an option

Save vpnry/e2411ec23048f1fbd5b17e258bada21c to your computer and use it in GitHub Desktop.
FROM ghcr.io/renderinc/heroku-app-builder:heroku-22 AS builder
# The FROM statement above triggers the following steps
# 1. Copy the contents of the directory containing this Dockerfile to a Docker image
# 2. Detect the language
# 3. Build the app using the appropriate Heroku buildpack. All Heroku's official buildpacks are supported.
# FROM busybox AS unpack
# unpacks zipped database
# https://stackoverflow.com/a/71805985
# WORKDIR /unpack
# COPY data/*.zip /
# RUN unzip ./data/*.zip
# FROM python:3.8-slim
# COPY --from=unpack /unpack/*.sqlite3 /
# # WORKDIR ../
# COPY ./ ./
# #move the unpacked db and delete the original
# RUN mv /*.sqlite3 ./data && rm -f ./data/*.zip
# RUN find ./data
# For running the app, we use a clean base image and also one without Ubuntu development packages
# https://devcenter.heroku.com/articles/heroku-22-stack#heroku-22-docker-image
FROM ghcr.io/renderinc/heroku-app-runner:heroku-22 AS runner
# Copy build artifacts to runtime image
COPY --from=builder --chown=1000:1000 /render /render/
COPY --from=builder --chown=1000:1000 /app /app/
# Switch to non-root user
USER 1000:1000
WORKDIR /app
RUN unzip ./data/ttpv_budsas.net.sqlite3.zip
RUN unzip ./data/tptk.sqlite3.zip
RUN unzip ./data/palidict.sqlite3.zip
RUN unzip ./data/paaukmed.sqlite3.zip
RUN rm -f ./data/ttpv_budsas.net.sqlite3.zip
RUN rm -f ./data/tptk.sqlite3.zip
RUN rm -f ./data/palidict.sqlite3.zip
RUN rm -f ./data/paaukmed.sqlite3.zip
RUN mv ./*.sqlite3 ./data/
RUN find ./data
# Source all /app/.profile.d/*.sh files before process start.
# These are created by buildpacks.
# https://devcenter.heroku.com/articles/buildpack-api#profile-d-scripts
ENTRYPOINT [ "/render/setup-env" ]
# 4. By default, run the 'web' process type defined in the app's Procfile
# You may override the process type that is run by replacing 'web' with another
# process type name in the CMD line below. That process type must have been
# defined in the app's Procfile during build.
CMD [ "/render/process/web" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment