Skip to content

feat: Fully containerized build#179

Open
ktaletsk wants to merge 1 commit intousnistgov:developfrom
ktaletsk:feat/Dockerfile-CI
Open

feat: Fully containerized build#179
ktaletsk wants to merge 1 commit intousnistgov:developfrom
ktaletsk:feat/Dockerfile-CI

Conversation

@ktaletsk
Copy link
Copy Markdown
Collaborator

@ktaletsk ktaletsk commented Dec 3, 2021

What does this PR do?

  • Renames the existing Dockerfile to Dockerfile.localdev as this file requires building of the Java artifact on the host (and therefore Java/Maven installed). This Dockerfile facilitates a rapid development mode when developer has all the tools installed on the host machine and changes code frequently.
  • Adds a new Dockerfile which utilizes two-stage build and does not require anything to be installed on the host other than Docker to produce the final image. First stage uses official Maven image (maven:3.8.3-jdk-8) to build the Java artifact; second stage uses the same openjdk:8-jdk-alpine image as before for the runtime image. The first stage is only used to build the artifact and then simply discarded (like a rocket stages do), so we don't carry Maven tools into production container. This Dockerfile is meant for CI pipelines or users who can't/don't want to install Java/Maven toolchain on their host machine, but still want to build the latest Docker image from WIPP-backend repo.
  • Replaces the obsolete MAINTAINER tag in favor of the label org.opencontainers.image.authors as recommended in the official docs: https://docs.docker.com/engine/reference/builder/#maintainer-deprecated.
  • Adds README instructions on usage of both Dockerfiles

fix: Replace obsolete MAINTAINER tag
docs: Instructions on how to use each of the Dockerfiles
ARG BACKEND_ARGO="wipp-backend-argo-workflows"

COPY pom.xml /usr/local/${BACKEND_ROOT}/pom.xml
COPY ${BACKEND_NAME} /usr/local/${BACKEND_ROOT}/${BACKEND_NAME}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix typo. This should be BACKEND_APP instead of BACKEND_NAME

ARG BACKEND_CORE="wipp-backend-core"
ARG BACKEND_ARGO="wipp-backend-argo-workflows"

COPY pom.xml /usr/local/${BACKEND_ROOT}/pom.xml
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to define a WORKDIR (/opt for example) instead of copying folders to /usr/local/?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants