Code Monkey home page Code Monkey logo

dockerize's People

Contributors

dev-dfm avatar jxstxn1 avatar passsy avatar robiness avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

robiness

dockerize's Issues

Where's the Dockerfile?

I'm running into this issue:

❯ pq docker build

πŸ’ͺ Building with sound null safety πŸ’ͺ

Compiling lib/main.dart for the Web...                             611ms
Creating image pascalq:dev
#1 [internal] load build definition from Dockerfile
#1 sha256:17c9e5d4c11bbfb110f145503ae2b7eff73a9f7544b4c33cd2552626af636148
#1 transferring dockerfile: 2B done
#1 DONE 0.0s
failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount362344577/Dockerfile: no such file or directory

Usage: You can execute the following commands:
β€’ pq docker
   β€’ build               Builds your project and the docker container
   β€’ run                 Runs the Docker Container on localhost:8000
     -b, --build         Calls the build command before running the app
     -p, --port  Set a custom entry port for the container
   β€’ stop                Stops the currently running docker container

Seems like I'm missing a Dockerfile, but I haven't found it. Any idea what to do?

Create bin folder

We should create the bin folder if it is not existing but server is already present

Document how to release the docker container

Currently, the container is tagged as $package_name:dev, overriding the old container.

I'd love to have some documentation how to tag the container with a version, i.e. the version from pubspec.yaml

Or maybe create a new option for building <cli> docker build --release

Add tests

I think we reached the crucial points where we need tests and shouldnt life without them anymore.

Add possibility to use envs

As a user I want to build different containers for different environments like: dev, preprod or prod.

Commands would look like this:

docker build --> Building dev if we dont specify anything
docker build --env=preprod --> Build the container for preprod

docker run --> runs the dev container
docker run --env=preprod --> runs the preprod container

I guess the principe is clear
@robiness any Improvements and/or ideas?

Simplify the use

ToΒ have a container started locally from scratch we now have to do 4 steps. For Example:

office sidekick plugins install --source path /Users/robin/testing/dockerize_sidekick_plugin

office dockerize

docker build -t app:dev .   

docker run -it --rm -p 8000:8080 --name app app:dev

This may can be reduced. Especially the docker commands may can get merged.
The image (called app for the time being) could be named like the cli? πŸ€”

Use mason-logger

I think we should consider using mason_logger as CLI Logger because it has some nice abilities compared to the normal print like: Overwriting an already printed print or loading indicators

Add option for dev browser

I think it would be quite nice if we could have a chrome instance which is reloading after a hot-reload

Improve ErrorHandling

0 failed: port is already allocated.

Usage: You can execute the following commands:
β€’ bam docker
   β€’ build               Builds your project and the docker container
   β€’ run                 Runs the Docker Container on localhost:8000
     -b, --build         Calls the build command before running the app
     -p, --port  Set a custom entry port for the container
   β€’ stop                Stops the currently running docker container

App is running on http://localhost:8000

If an error is occurring we should not print that the app is running or anything else.

Simplify command code:

I think we abstract the commands more to make it easily for users to run pre-/post-build code.
The command could look like this:

@override
Future<void> run() async{
  // Insert your custom preBuildCode here:
  flutter(
      ['build', 'web'],
      workingDirectory: mainProject!.root,
  );
  // Insert your pre DockerBuild Code here:
  buildDocker(); 
  // Run your post Docker Build Code
}

@robiness your thoughts about this?

Offer support for Dart Frog

I think it would be nice if we can support DartFrog next to Flutter Projects so that more people can benefit from the one command docker build

docker run should show output

After running <cli> docker run I can't see the log. The process completes right away.

Instead, I expected to see the log output and to stop the docker container with ctrl + C.

To run it in the background I'd use <cli> docker run &

Fix Port option

Currently the Port option is throwing if I enter a valid port
It also doesnt work if I overwrite the port manually

Add version.json

I think it would help to have something like a version.json to easily know some facts like: container_build_at and adding the possibility to add a Map<String, dynamic> to add more params by your own

Add readme to server Folder

I think we need some kind of readme in the server folder so that it is easier to orient in there and also be able to make changes faster without reading through each file to understand everything

Add option to disable hot-reload

We should add a flag or option to disable hot-reload.

Could be something like this: <<your_cli>> docker run --disable-hot-reload

Considering generating a nonce for the Flutter Scripts in index.html

We should consider adding a nonce to helmet and the index.html to be able to remove unsafe-inline and unsafe-eval.

How I think it could work:

  • In the BuildCommand we check the amount of script tags in the build index.html.
  • Then we generate this amount of nonces and add them to middlewares.dart and afterwards behind every script tag in the index.html

Edit:
TIL Nonce should be generated dynamically.
I'll try the same approach but with a sha256 hash

Edit2:
API will be that we probally can offer hash and nonce scripts, so users will have to add either 'sha256-'/'sha384-'/'sha512' or 'nonce-' to their script tags. The rest will be handled by us while building the container and serving the application
@robiness @passsy your thoughts about this

Disable CSP by default

I wasn't able to get my Flutter app including firebase running easily running. I had to manually add new CSP rules with requires a lot of knowledge:

  • Understanding the server code and middleware
  • knowing CSP and how to write rules

It would be easier for most if CSP would be disabled by default, but showing a warning at startup that it is not secure and not ready for production.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.