-
Notifications
You must be signed in to change notification settings - Fork 0
Example usage
Andrew Hosgood edited this page Oct 14, 2024
·
4 revisions
FROM ghcr.io/nationalarchives/tna-python:latest
# Copy in the application code
COPY --chown=app . .
# Install dependencies
RUN tna-build
# Run the application
CMD ["tna-run", "my_application:app"]
# This allows you to pass a build argument to change the image to a root level
# one such as tna-python-root
ARG IMAGE=ghcr.io/nationalarchives/tna-python
# This allows you to pass a build argument to change the base image version,
# for example in your local env, you could use the preview image
ARG IMAGE_TAG=latest
FROM "$IMAGE":"$IMAGE_TAG"
# Using the Docker build scripts, you can accept a BUILD_VERSION and pass it in
# as an envrironment variable which will allow you to output the build version
# in the code
# https://github.com/nationalarchives/ds-docker-actions/blob/main/.github/actions/docker-build/action.yml#L34
ARG BUILD_VERSION
ENV BUILD_VERSION="$BUILD_VERSION"
# Provide a build command used from your package.json to build Node assets
ENV NPM_BUILD_COMMAND=compile
# Copy in the application code
COPY --chown=app . .
# Install dependencies
RUN tna-build
# Delete source files and tests
RUN rm -fR /app/src /app/test
# Run the application
CMD ["tna-run", "my_application:app"]