alpine-docker / git

A useful simple git container running in alpine linux, especially for tiny linux distro, such as RancherOS, which don't have package manager.
Apache License 2.0
155 stars 86 forks source link

Advice on using with a multistage build? #31

Closed gnoejuan closed 3 years ago

gnoejuan commented 3 years ago

I was hoping to easily use this image in a multistage build. Looks like the workdir is /git, so if I were to have a dockerfile like:

FROM alpine/git as git-pull
RUN git clone -b libreoffice-7-1-1 https://git.libreoffice.org/core libreoffice
FROM ubuntu:20.10 as build
RUN mkdir /app
WORKDIR /app
COPY --from=git-pull /git/libreoffice .

I get COPY failed: stat git/libreoffice: file does not exist

Same with COPY --from=git-pull libreoffice .

COPY failed: stat libreoffice: file does not exist

Looking at the Dockerfile for alpine/git I assume it's because /git is used as a volume. I think that means I won't be able to use alpine/git. I guess I would like some confimation

ozbillwang commented 3 years ago

You can define to other folder when clone

RUN mkdir /app &&  git clone -b libreoffice-7-1-1 https://git.libreoffice.org/core /app/libreoffice