carpentries-incubator / docker-introduction

Reproducible Computational Environments using Containers
https://carpentries-incubator.github.io/docker-introduction/
Other
42 stars 48 forks source link

Follow best practices for building images - taking advantage of the cache. #125

Closed MiddelkoopT closed 2 years ago

MiddelkoopT commented 2 years ago

In 05b-advanced-containers in the section "Add the sum.py script to the PATH so you can run it directly:"

FROM alpine

COPY sum.py /home
# set script permissions
RUN chmod +x /home/sum.py
# add /home folder to the PATH
ENV PATH /home:$PATH

RUN apk add --update python3 py3-pip python3-dev

Should look something like

FROM alpine

RUN apk add --update python3 py3-pip python3-dev

COPY sum.py /home
# set script permissions
RUN chmod +x /home/sum.py
# add /home folder to the PATH
ENV PATH /home:$PATH

With the heavy download first (RUN apk add) to take advantage of the cache layers.

I can do a PR for this if desired.

jcohen02 commented 2 years ago

Thanks @MiddelkoopT, just running through some outstanding issues and have opened a PR (#173) for this.