I’m working on Mac/Docker/Bitrise-CLI stack. However, even though I succeed to build and generate APKs, there is no simple way to copy APK files to host machine. The only way I found is building APK on container’s bash and copy to host via ‘docker cp’ command during the container is up.
Is there any simple Step for this problem?
Hi @aigori,
When you run Docker on your Mac you specify which folders it should share (which volumes
to mount).
If you followed https://devcenter.bitrise.io/docker/run-your-build-locally-in-docker/ then the command you used was:
docker run --privileged --env CI=false --volume "$(pwd):/bitrise/src" --volume "/var/run/docker.sock:/var/run/docker.sock" --rm bitriseio/docker-android:latest bitrise run WORKFLOW
This means there are two volumes (directories or files) shared between the host (your Mac) and the guest (the docker container):
-
/var/run/docker.sock
which is simply just required to be able to run docker from within docker -
$(pwd):/bitrise/src
-> this shared the directory you run thedocker run
command in with the docker container, to the path/bitrise/src
inside the container
In short if you’re inside the container move your files under /bitrise/src
and those will be available on your Mac too. If you want to share a file into the container you can move that file into the directory where you run the docker run
command (or into any of its sub-directories).
Of course you can also add additional --volume
parameters, this is just docker
, nothing bitrise specific - docker docs: https://docs.docker.com/storage/volumes/
If you’d have any questions just let us know!
Note: if you use our standard docker images then that defines the BITRISE_DEPLOY_DIR
to be at the path /bitrise/deploy
(https://github.com/bitrise-docker/bitrise-base/blob/afbff1408313bd0ad243701accd190f40ed73992/Dockerfile#L18).
This means that if you use our steps which do move the deployable artifacts into that directory, then you can just add e.g. --volume "$HOME/bitrise/deploy:/bitrise/deploy"
flag to the docker run
command and this will mount the bitrise/deploy
directory from your Mac’s Home directory into the /bitrise/deploy
path inside the container. So, when a file is generated there it’ll be available on your Mac at HOME / bitrise/deploy
.
Of course you can create any directory, e.g. if you’d prefer to have this inside your Documents
directory, and bitrise-deploys
inside that, then you can use --volume "$HOME/Documents/bitrise-deploys:/bitrise/deploy"
and so when bitrise cli stores an artifact into $BITRISE_DEPLOY_DIR
it’ll be available in your Documents directory, inside the bitrise-deploys
sub directory.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.