Reputation: 96484
My Dockerfile is below. Currently I copy the dotfiles (which are referenced within the .bashrc) to /root Is there a better way to organize them?
FROM alpine:latest
LABEL maintainer="Michael Durrant<[email protected]>"
RUN apk add bash git vim
COPY alpine_bashrc /root/.bashrc
COPY .bash_functions.sh /root
COPY .bash_aliases /root
COPY .git-completion.bash /root
RUN "/bin/bash"
Upvotes: 1
Views: 96
Reputation: 29032
Instead of having 1 COPY
directive for each file, it might be advisable to have a directory instead. The limitation would be that the files must be named as they would appear in the container.
$ ls .
Dockerfile
dotfiles/
.bashrc
.git-completion.bash
.bash_functions.sh
.bash_aliases.sh
...
COPY dotfiles/ root/
Each of those COPY
directives creates a new layer in your container. Save space/time by having one directive.
Upvotes: 3