Skip to content

Commit

Permalink
Embed serve as default command to run the server container (#947)
Browse files Browse the repository at this point in the history
* Embed `serve` as default command to run the server container

* Set default command while allowing users to change

* Clean up dockerfile
  • Loading branch information
haoming29 authored Mar 14, 2024
1 parent f189dd4 commit 258ba5a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 26 deletions.
43 changes: 19 additions & 24 deletions images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ COPY --from=xrootd-plugin-builder /usr/include/nlohmann /usr/include/nlohmann
# Copy the JSON schema validator library
COPY --from=xrootd-plugin-builder /usr/lib64/libnlohmann_json_schema_validator.a /usr/lib64/

# Eventually add more entrypoint commands here
COPY images/entrypoint.sh /entrypoint.sh

# Copy here to reduce dependency on the pelican-build stage in the final-stage and x-base stage
Expand All @@ -206,17 +205,13 @@ RUN chmod +x /pelican/pelican \
######################
FROM final-stage AS pelican-base

WORKDIR /pelican

RUN rm -rf /pelican/osdf

######################
# OSDF base stage #
######################
FROM final-stage AS osdf-base

WORKDIR /pelican

RUN rm -rf /pelican/pelican

####################
Expand All @@ -225,66 +220,66 @@ RUN rm -rf /pelican/pelican

FROM pelican-base AS cache

WORKDIR /pelican
ENTRYPOINT ["/entrypoint.sh", "pelican", "cache"]
ENTRYPOINT [ "/entrypoint.sh", "pelican", "cache"]
CMD [ "serve" ]

####################
# pelican/origin #
# pelican/origin #
####################

FROM pelican-base AS origin

WORKDIR /pelican
ENTRYPOINT ["/entrypoint.sh", "pelican", "origin"]
ENTRYPOINT [ "/entrypoint.sh" ,"pelican", "origin"]
CMD [ "serve" ]

####################
# pelican/director #
####################

FROM pelican-base AS director

WORKDIR /pelican
ENTRYPOINT ["/entrypoint.sh", "pelican", "director"]
ENTRYPOINT [ "/entrypoint.sh" ,"pelican", "director"]
CMD [ "serve" ]

####################
# pelican/registry #
####################

FROM pelican-base AS registry

WORKDIR /pelican
ENTRYPOINT ["/entrypoint.sh", "pelican", "registry"]
ENTRYPOINT [ "/entrypoint.sh" ,"pelican", "registry"]
CMD [ "serve" ]

####################################
# OSDF #
####################################

####################
# osdf/cache #
# osdf/cache #
####################

FROM osdf-base AS osdf-cache

WORKDIR /pelican
ENTRYPOINT ["/entrypoint.sh", "osdf", "cache"]
ENTRYPOINT [ "/entrypoint.sh" ,"osdf", "cache"]
CMD [ "serve" ]

####################
# osdf/origin #
# osdf/origin #
####################

FROM osdf-base AS osdf-origin

WORKDIR /pelican
ENTRYPOINT ["/entrypoint.sh", "osdf", "origin"]
ENTRYPOINT [ "/entrypoint.sh" ,"osdf", "origin"]
CMD [ "serve" ]

####################
# osdf/director #
####################

FROM osdf-base AS osdf-director

WORKDIR /pelican
ENTRYPOINT ["/entrypoint.sh", "osdf", "director"]
ENTRYPOINT [ "/entrypoint.sh" ,"osdf", "director"]
CMD [ "serve" ]


####################
Expand All @@ -293,5 +288,5 @@ ENTRYPOINT ["/entrypoint.sh", "osdf", "director"]

FROM osdf-base AS osdf-registry

WORKDIR /pelican
ENTRYPOINT ["/entrypoint.sh", "osdf", "registry"]
ENTRYPOINT [ "/entrypoint.sh" ,"osdf", "registry"]
CMD [ "serve" ]
4 changes: 2 additions & 2 deletions images/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,6 @@ if [ $# -ne 0 ]; then
;;
esac
else
echo "usage: [command] [args...]"
echo "example: docker run pelican_platform/cache serve -p 8443"
echo "Usage: [args...]"
echo "example: docker run pelican_platform/cache -p 8443"
fi

0 comments on commit 258ba5a

Please sign in to comment.