Closed srwareham closed 11 months ago
I think the problem is, that you have to build the vue frontend first. That's why it complains about missing webpack files.
If you have a look at the build pipeline, there is an additional step using yarn to build the frontend. You would have to run something similar before building the docker file: https://github.com/TandoorRecipes/recipes/blob/develop/.github/workflows/build-docker.yml#L47-L58
# Build Vue frontend
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: yarn
cache-dependency-path: vue/yarn.lock
- name: Install dependencies
working-directory: ./vue
run: yarn install --frozen-lockfile
- name: Build dependencies
working-directory: ./vue
run: yarn build
It would maybe be possible to use a multistage docker build but that's not possible with the official docker file right now.
This is not mentioned in the contributing guidelines because for local development you are supposed to run a dev server for the vue frontend with yarn serve
. Is there a special reason why you want to build the docker image for development?
Thank you!! That worked and taught me something new about github workflows/builds and vue. I wanted to build the docker image for development for 2 good reasons and one bad:
Out of curiosity, why is it better to have the yarn steps outside of the Dockerfile? Wouldn't having them in the Dockerfile make it more accurately depict the contents of a running environment? No worries either way, I appreciate the time you've taken already!
Great that it worked, these reasons are very valid and I also already stumbled over the problem that just executing the docker build doesn't work without extra steps. As to why it isn't done in the docker build: I don't know, probably historical reasons and a "simpler" Dockerfile. There shouldn't really be a reason why we can't change it.
Great that it worked, these reasons are very valid and I also already stumbled over the problem that just executing the docker build doesn't work without extra steps. As to why it isn't done in the docker build: I don't know, probably historical reasons and a "simpler" Dockerfile. There shouldn't really be a reason why we can't change it.
Building in the container would require all of the source files and development tooling which would significantly bloat the size of the container.
This can be avoided by using multi-stage builds. Essentially you do all the compiling and building steps in one stage, copy only the final wheels and other stuff which is needed to run the container into the final stage and then discard the build stage. So the yarn build process could be done in its own stage.
This can be avoided by using multi-stage builds. Essentially you do all the compiling and building steps in one stage, copy only the final wheels and other stuff which is needed to run the container into the final stage and then discard the build stage. So the yarn build process could be done in its own stage.
Which in turn adds complexity to those running manual installs. I don’t see any compelling reason to switch how it’s currently working.
I'm not sure how using multi-stage builds would add complexity. For people using the manual setup nothing changes because the changes would only affect the docker build. For people who want to build the docker image themselves it's arguably easier because they don't need to know/ remember the additional node build step before building the image. But I agree that it's not a very common use case. Issues like this one show though, that people stumble over this problem.
@smilerz what complexity are you worried about for manual installs? I think a goal of "just build the dockerfile and it will run" is nice aspiration if not in conflict with core processes.
Issue
I'd like to try writing a few features for Tandoor but cannot get a local build to run. In every instance, I hit a
Server Error (500)
on the frontend andFileNotFoundError: [Errno 2] No such file or directory: '/opt/recipes/vue/webpack-stats.json'
in the command line backend.I have tried two different approaches to setting up a test environment:
In both cases, I get the error saying there's no webpack-stats.json file. I have also tried both approaches while checking out the 1.5.3 tag of the git repo, but still hit the same error. In both cases, the error seems to originate during the
python manage.py runserver
part of boot.sh.When I try approach 2, I can manually navigate to the settings page, but not any of the recipes or the default
/search
landing page. If I revert my docker-compose.yml to use vabene1111/recipes:1.5.3 everything works fine. But then I can't test new features.Thank you!
Tandoor Version
1.5.3
OS Version
Arch Linux (Linux Arch 6.3.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 21 Jun 2023 20:46:20 +0000 x86_64 GNU/Linux)
Setup
Docker / Docker-Compose
Reverse Proxy
Others (please state below)
Other
nginx
Environment file
Docker-Compose file
Relevant logs