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

Matthew Wang
2021-05-11 12:34

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"]