How do I build a customized Artifactory image? [Video]

How do I build a customized Artifactory image? [Video]

AuthorFullName__c
Matthew Wang
articleNumber
000005031
ft:sourceType
Salesforce
FirstPublishedDate
2021-04-14T09:04:35Z
lastModifiedDate
2024-03-10T07:43:57Z
VersionNumber
6


You can create your own image with a dockerfile and using the "docker build" command.

docker build -t <imageName>:<tag> 

Examples of a custom Dockerfile using existing Artifactory images as base image can be found below:
https://github.com/jfrog/jfrog-distroless/tree/master/customize-example
# The Artifactory official Docker image
FROM releases-docker.jfrog.io/jfrog/artifactory-pro:7.15.3 AS base

# The new image based on ubuntu:18.04
FROM ubuntu:18.04

# Environment needed for Artifactory
ENV ARTIFACTORY_USER_NAME=artifactory \
    ARTIFACTORY_USER_ID=1030 \
    ARTIFACTORY_HOME=/opt/jfrog/artifactory \
    ARTIFACTORY_DATA=/var/opt/jfrog/artifactory \
    ARTIFACTORY_EXTRA_CONF=/artifactory_extra_conf \
    RECOMMENDED_MAX_OPEN_FILES=32000 \
    MIN_MAX_OPEN_FILES=10000 \
    JAVA_HOME=/java/jdk-11.0.2+9 \
    RECOMMENDED_MAX_OPEN_PROCESSES=1024

# Copy needed file system from base (Artifactory image)
COPY --from=base /opt/jfrog /opt/jfrog
COPY --from=base /var/opt/jfrog/artifactory /var/opt/jfrog/artifactory
COPY --from=base /entrypoint-artifactory.sh /entrypoint-artifactory.sh

# Create the user, fix file system ownership and install needed tools with apt-get
# NOTE - wget must be installed for Artifactory HA
RUN useradd -M -s /usr/sbin/nologin --uid ${ARTIFACTORY_USER_ID} --user-group ${ARTIFACTORY_USER_NAME} && \
    chown -R ${ARTIFACTORY_USER_NAME}:${ARTIFACTORY_USER_NAME} ${ARTIFACTORY_HOME}  ${ARTIFACTORY_DATA} && \
    apt-get update && apt-get install -y wget curl

USER $ARTIFACTORY_USER_NAME

VOLUME ${ARTIFACTORY_DATA}
VOLUME ${ARTIFACTORY_EXTRA_CONF}

ENTRYPOINT ["/entrypoint-artifactory.sh"]

Video Transcript:
Hi there. My name is Matthew. In this video I’m going to go over how to build a customized Artifactory image. Now, the use case for this is, if say the base Artifactory image is missing some tools. Or do you want to better support automation. For example, for setting up an HA cluster. So you can create your own image with a Dockerfile using the docker build command. We have some examples of some Dockerfiles at this link.

So you can run the docker build command like so. I already built earlier, so it worked really fast. But if you want to take a quick look at the Dockerfile. As you can see, it’s taking Artifactory 715.3 as base and putting it on top of Ubuntu. And there’s much picture… Stuff here like, environment variables, copying some stuff from the base.

And then here we can now see that we’re getting some applicants install stuff. And now, we run this image… See, Artifactory should be starting up now. Yeah. And I’ll go through its setup and actually finish. Well, thanks for your time. And for watching this video. And I hope it helps.