Update 2
My previous solution is still very inconvenient because I have to check in every time before I re-launch the app.
With great support I found a much more convenient solution.
Instead of an symlink I mount the directory. See https://superuser.com/questions/842642 for more details.
I don't know if and how this can work on other oSes (Win, OX X, ...)
I mount ../my_package
to docker/my_package
(instead of a symlink) and use this Dockerfile:
FROM google/dart
WORKDIR /app
ENV DART_SDK /usr/lib/dart
ADD dart_run.sh /dart_runtime/
RUN chmod 755 /dart_runtime/dart_run.sh && \
chown root:root /dart_runtime/dart_run.sh
ADD pubspec.yaml /app/
ADD pubspec.lock /app/
ADD docker/my_package /my_package
RUN pub get
ADD . /app/
RUN pub get --offline
## Expose ports for debugger (5858), application traffic (8080)
## and the observatory (8181)
EXPOSE 8080 8181 5858
CMD []
ENTRYPOINT ["/dart_runtime/dart_run.sh"]
Update 1
It turns out just serving the .git
directory of the checked out package though git-daemon
is a much more convenient solution.
All I had to do was setting all up according to the docs at https://www.dartlang.org/cloud/ and use a git dependency in pubspec.yaml
to this repo served by git-daemon.
my_package:
git:
url: git://192.168.2.96/my_package
ref: test
This url works when working locally and also within the Docker container.
Original
I can run my app with this Dockerfile
FROM google/dart
WORKDIR /app
RUN \
apt-get update && \
apt-get install -y openssh-client
ADD tool/bitbucket_deployment_key /root/.ssh/id_rsa
RUN \
mkdir -p /root/.ssh && \
echo "Host bitbucket.org" >> /root/.ssh/config && \
echo " StrictHostKeyChecking no" >> /root/.ssh/config && \
# ssh-keyscan -t rsa -H bitbucket.org,131.103.20.167 >> /root/.ssh/known_hosts && \
chmod 400 /root/.ssh/id_rsa && \
eval $(ssh-agent) && \
ssh-add /root/.ssh/id_rsa
RUN \
git clone git@bitbucket.org:myuser/my_package.git /my_package --branch test && \
rm /root/.ssh/id_rsa
#ENV DART_SDK /usr/lib/dart
ADD dart_run.sh /dart_runtime/
RUN chmod 755 /dart_runtime/dart_run.sh && \
chown root:root /dart_runtime/dart_run.sh
ADD pubspec.yaml /app/
ADD pubspec.lock /app/
RUN pub get
ADD . /app/
RUN pub get --offline
# Expose ports for debugger (5858), application traffic (8080)
# and the observatory (8181)
EXPOSE 8080 8181 5858
CMD []
ENTRYPOINT ["/dart_runtime/dart_run.sh"]
I created id_rsa
with ssh-keygen without a passphrase. This is the reason I delete the file from the image after the git clone
command. It isn't used afterwards anyway.
In my BitBucket repo I added id_rsa.pub
as a deployment key.