Skip to content

Commit

Permalink
Adjust Dockerfile to match picachooser's (working) version
Browse files Browse the repository at this point in the history
  • Loading branch information
bbfrederick committed Nov 18, 2024
1 parent b1a2a27 commit 9ef6990
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ ARG GITSHA
ARG GITDATE

# set and echo environment variables
ENV BUILD_TIME $BUILD_TIME
ENV BRANCH $BRANCH
ENV BUILD_TIME=$BUILD_TIME
ENV BRANCH=$BRANCH
ENV GITVERSION=${GITVERSION}
ENV GITSHA=${GITSHA}
ENV GITDATE=${GITDATE}
Expand All @@ -21,30 +21,47 @@ RUN echo "GITVERSION: "$GITVERSION
RUN echo "GITSHA: "$GITSHA
RUN echo "GITDATE: "$GITDATE

# Install capcalc
# copy capcalc into container
COPY . /src/capcalc
RUN echo $GITVERSION > /src/capcalc/VERSION

# init and install picachooser
RUN uv pip install --upgrade pip
RUN cd /src/capcalc && \
pip install . && \
rm -rf /src/capcalc/build /src/capcalc/dist
uv pip install .
RUN chmod -R a+r /src/capcalc

# install versioneer
RUN cd /src/picachooser && \
versioneer install --no-vendor && \
rm -rf /src/picachooser/build /src/picachooser/dist

# clean up
#RUN mamba clean -y --all
RUN pip cache purge

# Create a shared $HOME directory
RUN useradd -m -s /bin/bash -G users capcalc
WORKDIR /home/capcalc
ENV HOME="/home/capcalc"
ENV USER=capcalc
RUN useradd \
--create-home \
--shell /bin/bash \
--groups users \
--home /home/$USER \
$USER
RUN cp ~/.bashrc /home/$USER/.bashrc; chown $USER /home/$USER/.bashrc

WORKDIR /home/$USER
ENV HOME="/home/$USER"

ENV IN_DOCKER_CONTAINER=1

RUN ldconfig
WORKDIR /tmp/
ENTRYPOINT ["capcalc_dispatcher"]

# set a non-root user
USER capcalc
# set to non-root user and initialize mamba
USER $USER
RUN /opt/miniforge3/bin/mamba init

ENTRYPOINT ["/opt/miniforge3/envs/science/bin/capcalc_dispatcher"]

LABEL org.label-schema.build-date=$BUILD_TIME \
org.label-schema.name="capcalc" \
Expand Down

0 comments on commit 9ef6990

Please sign in to comment.