Installing an editable python package inside a docker container - docker

I am trying to fix a bug in a python package for my project that runs inside a docker container.
The package I am talking about is django-allauth and I found a small with one of the providers.
I know that I need to copy the edited package into the container and install it like this:
COPY folder/with/package /somefolder_inside_container/
RUN pip install -e /somefolder_inside_container/
The root folder of this project on github contains a lot of files and I am not sure if I should include them for copying to make sure the package installs. Do i need to copy anything besides the 'allauth' folder that contains all the models/views/etc. ?

Related

Install dependencies in container using deps.edn

I inherited a clojure code base and I'm trying to containerize it for local development. The creators used deps.edn to manage the dependencies. However, I can't figure out what RUN command I should use to pre-install the dependencies for the project.
Currently, my entrypoint is the following ['clj', '-m', 'app'] which installs the dependencies every time I start the container.
How do I pre-install dependencies for a clojure project using a Docker RUN command?
Deps/CLI caching is described here. Generally speaking, dependencies are downloaded once and saved in a subdirectory of the project directory named
./.cpcache # "class path cache"
The ./.cpcache directory is analagous to the ~/.m2 cache directory used by Maven and related tools (e.g. Leiningen).
If you run the code locally, you should be able to copy the .cpcache dir with its cached dependencies into your Docker container. Then the dependencies don't need to be re-downloaded
for each startup of the Docker container.
See also the Deps/CLI overview.
P.S.
This template project is set up to run using both lein and Deps/CLI via the Kaocha tool. You may find the comparison helpful.
P.P.S.
You may find it easiest to run your code by building an uberjar file which contains all your code and all
dependencies in a single artifact. You can do this either using Leiningen or other tools such as depstar. You then invoke the application with a single command like:
java -jar demo-0.1.0-standalone.jar
Running this should do it:
clj -P

python bundled by py2app still points to local path

I would like to create a macOS app using py2app. My application (testapp) has a few dependencies
(paramiko,scp,PyYAML,PyQt5). To do so:
I installed python3 using brew (located in /usr/local/Cellar).
I installed the aforementioned dependencies in this python
I ran python3 setup.py py2app --packages paramiko,yaml,scp
Everything runs apparently fine. I have a testapp.app directory created in dist. However, when I run the python located in the bundle (./dist/testapp.app/Contents/MacOS/python) I run into troubles. Indeed, I can import the aforementioned external packages but when I inspect their path, the result gives me the local installation and not the one of the bundle.
For instance paramiko.__path__ gives me: /usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/paramiko
Looking deeper into the bundle, I could not find the file site-packages.zip which should be created by py2app.
As such my bundle is absolutely not self consistent and can not be distributed on other machines. Would you have any idea about what is wrong with my setup ?
EDIT: I forgot to mention that I started to inspect the embedded python because running the embedded app failed.

Is it possible to create a custom cdk init template to leverage pipenv for my python project?

I would like to utilize pipenv as my virtual environment manager and for my dependency management for my Python cdk projects, upon running 'cdk init'. I read that you can specify a 'custom' application template but could not find documentation on creating one. Is it possible and can the virtual environment/dependency manager be controlled using this feature?
I would like to be able to run 'cdk init hello-world --language python' and have the scaffolding for the project be generated BUT using pipenv.
It's not possible to do that without modifying the source code for the CDK package itself. You likely won't want to manage your own divergent version of the standard package.
I've shoe-horned CDK to work with PipEnv a couple of times, and it's more work than it's worth at this point. The problem is that PipEnv forces the . delimiter in the package name to a -; pipenv install aws-cdk.aws-rds is listed as aws-cdk-aws-rds in the Pipfile, and the package installations don't actually work.
There's an open issue on the repo for this though (https://github.com/aws/aws-cdk/issues/3671), so you could +1 there in hopes that they can address it. It really is an issue with Pipenv though.
Following the link from Scott for the open issue, it looks like this works now, provided the package name is in quotes.

Is it possible to avoid updating drupal core with composer update?

I'm trying to build a docker container where the dockerfile installs a specific version of drupal, I copy over custom copies of composer.json/composer.lock and then do a composer update to download the contributed modules specified in these composer files. I know that ideally composer would also control core, but for this project, I'm trying to avoid that.
The problem I'm having is that composer update seems to also reinstall drupal, where I want the dockerfile to be in control of this and I'd like composer to just manage the modules.
Is this something I could do by modifying the composer files (so far tests have not worked)? It seems you can't specify a package for composer to ignore and where I see you can specify specific packages to update, that's not really a viable solution for this.
Thanks
OK, it's looking like the issue was the composer.lock/json files I was adding to run composer update were initially created by using composer create-project drupal-composer/drupal-project, which installed core and thus added it to the composer.lock/json files.
It seems that by just reinstalling the contributed modules with composer in a fresh drupal site (so simplified composer files) might be the answer.

AEM OSGI bundle using docker container | Which forms add on package should I install?

As per our requirement we need to use AEM OSGI bundle configuration.
I am currently working on Apple Macbook.
To use FormsService and OutputService we installed "AEM-FORMS-6.4-OSX" package under "http://localhost:4502/crx/packageshare/index.html#"
(For windows we install "AEM-FORMS-6.4-WIN").
We have followed below installation steps:
Saved "AEM-quickstart.jar", "license.properties" files at one place.
Ran the jar file using the command "java -jar AEM-quickstart.jar"
Access http://localhost:4502/crx/packageshare/index.html#
Search for "AEM-FORMS-6.4-OSX"
Download the package
Install the package
To reconfirm wether the package is successfully installed, you can go this path "./crx-quickstart/bedrock/svcnative/XMLFormService" and check if bin and META-INF folders are present.
Above steps are for AEM-OSGI configuration on macbook.
Now, I wanted to install this aem-quickstart jar inside a docker container
So steps I followed is:
1. Saved Dockerfile, "AEM-quickstart.jar", "license.properties" files at one place.
2. Ran the Dockerfile with command : "docker run -p 4502:4502 -t aem_quickstart"
3. Access http://localhost:4502/crx/packageshare/index.html#
4. Search for "AEM-FORMS-6.4-OSX"
5. Download the package
6. Install the package
7. Here, when I tried to traverse the path "./crx-quickstart/bedrock/svcnative/XMLFormService" I didnot find any bin folder.
Here my question is:
1. On which OS/platform does docker images run?
2. Which Forms Add on package should I install?
3. Because I am on mac OS I tried to install "AEM-FORMS-6.4-OSX" package but was unsuccessful. Also tried installed "AEM-FORMS-6.4-LX" but was unsuccessful.
Please help me here.. Let me know if any additional information is required
FYI - Docker file has script as follows:
FROM openjdk:8-jdk-alpine
COPY AEM_6.4_Quickstart.jar AEM_6.4_Quickstart.jar
COPY license.properties license.properties
EXPOSE 4502
CMD java -XX:MaxPermSize=256m -Xmx1024M -jar AEM_6.4_Quickstart.jar

Resources