I recently migrated from Heroku to render. Everything is working fine, except that deployments are slow.
The application is build using maven, and the problem is that the MAVEN_CUSTOM_GOALS are being ignored.
During the migration from Heroku:
The environment variables MAVEN_CUSTOM_GOALS and MAVEN_CUSTOM_OPTS were correctly brought into the environment.
And the Dockerfile.render file was created with:
ARG HEROKU_STACK=v2-heroku-20
FROM ghcr.io/renderinc/heroku-app-builder:${HEROKU_STACK} AS builder
When I read the deployment logs, I see that the maven build runs with the command ./mvnw -DskipTests clean dependency:list install which is the default for heroku-buildpack-java.
How can I get these environment variables to flow through and affect the build?
Hey there,
If you crack open the Dockerfile.render that was created, in there you should see a commented-out section of ARG examples to bring into the environment at build time - you’ll need to list whatever environment variables you want available to the build in there,
Thanks, I appreciate the answer, and I’ll look into using ARGs. However, the generated Dockerfile.render file doesn’t have a section of ARG examples. Here’s the generated file in its entirety.
# "v2-" stacks use our new, more rigorous buildpacks management system. They
# allow you to use multiple buildpacks in a single application, as well as to
# use custom buildpacks. We do not support using the original stack images with
# @renderinc/heroku-import v3.0.0 and above.
ARG HEROKU_STACK=v2-heroku-20
FROM ghcr.io/renderinc/heroku-app-builder:${HEROKU_STACK} 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. Build the app using the appropriate Heroku buildpacks. This supports both Heroku and custom buildpacks.
# For running the app, we use a clean base image and also one without Ubuntu development packages
# https://devcenter.heroku.com/articles/heroku-20-stack#heroku-20-docker-image
FROM ghcr.io/renderinc/heroku-app-runner:${HEROKU_STACK} 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
# 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" ]
# 3. 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" ]
Ah, that looks like an older generation, if you do a heroku update then you’ll get a newer version of the plugin and then a new run of the import command and you’ll get a Dockerfile.render which will make sense based on what I said originally