How to remove Tailwind from Docker & Laravel9 with Breeze - docker

I was just curious about removing Tailwind from Docker & Laravel (9.38.0) with Breeze installed as follows:
$ curl -s "https://laravel.build/test" | bash
$ cd test/
$ composer require laravel/breeze --dev
$ php artisan breeze:install
$ php artisan migrate
$ composer install
$ npm install
I remove tailwind and alpine from resources/css/App.css and resources/js/App.js and sail up, however they were there as if nothing happened... How are they included?
Additionally, I tested to install without Docker as below. Tailwind and Alpine.js were not included as I expected.
$ composer create-project laravel/laravel test2
$ cd test2/
$ composer require laravel/breeze --dev
$ php artisan breeze:install
$ php artisan migrate
$ composer install
$ npm install
What cause the difference?
Thanks.

Related

Connecting to snowflake from aws lambda using snowflake connector in aws lambda layer

I am running to this error when connecting to snowflake from aws lambda code.
Unable to import module 'lambda_function': /lib64/libc.so.6: version GLIBC_2.28 not found (required by /opt/python/lib/python3.9/sitepackages/cryptography/hazmat/bindings/_rust.abi3.so
I have tried a built snowflake connector dependecies using these steps
docker run -v /Users/Documents/docker_test:/working -it --rm ubuntu
install python 3.9.6 version using How to install python3.9 on linux ubuntu terminal?
3. apt-get update
$ apt-get install python3-pip ( this seems to install python 3.10 as well)
$ apt-get install zip
$ apt-get install python3-venv
$ cd lambda
$ mkdir my-lambda-function
$ cd my-lambda-function
$ python3 -m venv venv
$ source venv/bin/activate
$ pip3 install snowflake-connector-python
$ cd venv/lib/python3.9/site-packages
$ zip -r9 ${OLDPWD}/function.zip .
Since 3.10 and 3.9 python were install, i alias python and python3 to python3.9
How i resolve /lib64/libc.so.6: version GLIBC_2.28 ?

cannot execute binary file while deploying rails app on heroku

I am trying to deploy my Rails app on Heroku and having an error.
I am on macOS and, I have run are
replace REPLACE_ME_OS/REPLACE_ME_ARCH with values as noted below
$ wget https://cli-assets.heroku.com/heroku-cli/channels/stable/heroku-cli-linux-x64.tar.gz -O heroku.tar.gz
$ tar -xvzf heroku.tar.gz
$ mkdir -p /usr/local/lib /usr/local/bin
$ sudo mv heroku-cli-v6.x.x-darwin-64 /usr/local/lib/heroku
$ sudo ln -s /usr/local/lib/heroku/bin/heroku /usr/local/bin/heroku
and when I run heroku -v, I am getting
/usr/local/bin/heroku: line 29: /usr/local/lib/heroku/bin/node: cannot execute binary file
Any help?
You've downloaded the Linux version, not the macOS version. Use the macOS installer available directly from Heroku or use Homebrew:
brew tap heroku/brew && brew install heroku

Sass is not found for gulp-ruby-sass within Docker container

I have a web application that uses the gulp-ruby-sass plugin and it runs within a container that installs the sass gem.
This is the Dockerfile:
FROM phusion/passenger-customizable:0.9.19
# Set correct environment variables.
ENV HOME /root
# Use baseimage-docker's init process.
CMD ["/sbin/my_init"]
# Build system and git.
RUN /pd_build/utilities.sh && \
# Ruby support.
/pd_build/ruby-2.3.*.sh && \
# Node.js and Meteor support.
/pd_build/nodejs.sh && \
npm install -g gulp jspm yarn && \
npm install phantomjs-prebuilt#2.1.9 && \
mv node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs /usr/bin && \
rm -r node_modules && \
# Clean up APT when done.
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
EXPOSE 9000
WORKDIR /var/www/
CMD /bin/bash
This is the bootstrap script file (to bootstrap the application):
#! /bin/bash
bundle install
npm install
jspm install
npm config set bin-links false
npm rebuild node-sass
gulp watch
This is the Gemfile:
source "https://rubygems.org"
gem "sass"
And I launch the container this way:
docker run -it --name web -p 9000:9000 --volume $(pwd):/var/www brainy_web sh bootstrap.sh
The problem is that when the gulp task gulp build-css is executed using docker-compose, it doesn't find the sass gem as it is shown in the log: Gem sass is not installed (complete log here), but when I run the container with bash and execute the bootstrap.sh file everything runs smoothly.
Any thoughts on how to use sass with docker and gulp-ruby-sass?
UPDATE
I found that executing from the outside the gulp task, it doesn't find either:
docker exec web gulp build-css
I found the solution! I followed the advice from #webert-s-lima and in here: https://stackoverflow.com/a/29999734/532912
I just added the -l argument when launching the container. The statement would be like this:
docker run -it --name web -p 9000:9000 --volume $(pwd):/var/www brainy_web /bin/bash -l bootstrap.sh

linux source command not working when building Dockerfile

I have a Dockerfile that defines a Ruby on Rails stack.
Here is the Dockerfile:
FROM ubuntu:14.04
MAINTAINER example <examplen#example.com>
# Update
RUN apt-get update
# Install Ruby and Rails dependencies
RUN apt-get install -y \
ruby \
ruby-dev \
build-essential \
libxml2-dev \
libxslt1-dev \
zlib1g-dev \
libsqlite3-dev \
nodejs \
curl
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
RUN curl -sSL https://get.rvm.io | bash -s stable --rails
RUN /bin/bash -c "source /usr/local/rvm/scripts/rvm"
# Install Rails
RUN gem install rails
# Create a new Rails app under /src/my-app
RUN mkdir -p /src/new-app
RUN rails new /src/new-app
WORKDIR /src/my-app
# Default command is to run a rails server on port 3000
CMD ["rails", "server", "--binding", "0.0.0.0", "--port" ,"3000"]
EXPOSE 3000
When I execute the command docker build -t anotherapp/my-rails-app . I get the following error:
Removing intermediate container 3f8060cdc6f5
Step 8 : RUN gem install rails
---> Running in 8c1793414e63
ERROR: Error installing rails:
activesupport requires Ruby version >= 2.2.2.
The command '/bin/sh -c gem install rails' returned a non-zero code: 1
It looks like the command source /usr/local/rvm/scripts/rvm isn't working during the build.
I'm not sure exactly why this is happening.
From the docker builder reference, each RUN command is run independently. So doing RUN source /usr/local/rvm/scripts/rvm does not have any effect on the next RUN command.
Try changing the operations which require the given source file as follows
RUN /bin/bash -c "source /usr/local/rvm/scripts/rvm ; gem install rails"
This doesn't directly answer your question, but it's another way to approach the problem.
Docker provides an official Ruby image. This is the image the Docker Compose and Rails quickstart tutorial uses. As you can see from their example (below), you can copy your Gemfile.lock into your image and run bundle install without having to worry about RVM.
FROM ruby:2.2.0
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
RUN mkdir /myapp
WORKDIR /myapp
ADD Gemfile /myapp/Gemfile
ADD Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
ADD . /myapp
You will normally only have one rails application running inside a container using a specific version of Ruby so RVM's ability to manage multiple version of Ruby won't be helpful.
If you are curious how the official images are made, the Dockerfile is on Github.
As to why this is happening. As others pointed out, source command executes the file in the current shell. Each RUN instruction
... will execute any commands in a new layer on top of the current image and commit the results. The resulting committed image will be used for the next step in the Dockerfile.
Each RUN, ADD, COPY instruction essentially starts a new shell in a new container and executes a command.
1 RUN /bin/bash -c "source /usr/local/rvm/scripts/rvm"
2 RUN gem install rails
Can be read as
1 Start a brand new shell
Execute: source /usr/local/rvm/scripts/rvm
Save the state of the file system as an image
Exit shell
2 Start a brand new shell
Execute: gem install rails
...
When step 1 finishes, the shell (and everything your sourced into it), goes away.

Why does docker overwrite everything I've installed?

I've got a rails proxy app that runs with jupyter notebooks, and I'm trying to get a docker image up and running with supervisor as the entry point.
However, after including a FROM jupyter/notebook, everything I did to set up the rails is gone!
My dockerfile
#Installs Jupyter Notebook and IPython kernel from the current branch
# Another Docker container should inherit with `FROM jupyter/notebook`
# to run actual services.
# For RVM support - ultimately do out own solution here.
FROM tzenderman/docker-rvm:latest
# Update aptitude
RUN apt-get update
# Install software
RUN apt-get install -y git supervisor libgmp3-dev
# Set up loggin for now
RUN mkdir -p /var/log/supervisor
# USING TOKENS ###################################################
ARG DEPLOYMENT_TOKEN
RUN git clone https://$DEPLOYMENT_TOKEN:x-oauth-basic#github.com/proversity-org/edx-api-jupyter.git /tmpapp/
RUN mkdir /home/sifu/
RUN cp -R /tmpapp/* /home/sifu/
RUN cp -R -r /tmpapp/. /home/sifu/
RUN chown root:root -R /home/sifu/
#################################################################
WORKDIR /home/sifu
# Install ruby using RVM
RUN /bin/bash -l -c "rvm install $(cat .ruby-version) --verify-downloads"
RUN /bin/bash -l -c "rvm use $(cat .ruby-version) --default"
RUN /bin/bash -l -c "rvm list"
RUN rvm requirements
# run docker env for ruby apps
RUN /bin/bash -l -c "source .docker-ruby-version"
RUN echo $RUBY-VERSION
ENV GEM_HOME /usr/local
ENV PATH /usr/local/rvm/gems/ruby-2.2.3/bin:$PATH
ENV PATH /usr/local/rvm/rubies/ruby-2.2.3/bin:$PATH
# Install Bundler
RUN ruby --version
RUN gem install bundler
RUN bundle config --global silence_root_warning 1
# Install Sifu gems
RUN bundle install --gemfile=/home/sifu/Gemfile
# Alow for arugments to sifu & notebook (server ip & port etc)
#RUN /bin/bash -l -c "which bundle"
#RUN /bin/bash -l -c "cp $(which ruby) /usr/bin/"
# Set up supervisor config -- move this up later
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Set as environment variables
FROM jupyter/notebook
CMD ["/usr/bin/supervisord"]
ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/myapp/supervisord.conf"]
All the software I installed is gone, when I use a FROM jupyter/notebook to include the notebooks in the image.
Is there something crucial I am missing?

Resources