--When you build the laravel environment with laradock without modifying the file, zsh is selected by default, so change it to fish. --By the way, config.fish and .vimrc also bring local ones.
--A fledgling engineer who wants to finish the environment construction of laravel quickly and concentrate on learning coding --People who want to use fish with laradock but are not familiar with docker (although most people who end up with fish feel like dockerfile is messed up ...) --People who are in trouble because the hierarchy increases more like / var / www / sample-project in the workspace container if you follow the other articles
Directory where you want to install cd laradock
git clone https://github.com/Laradock/laradock.git
--You should have a directory called laradock.
cd laradock
cp ~/config/fish/config.fish ./workspace
cp ~/.vimrc ./workspace
vim ./workspace/Dockerfile
--Please add the following. ――The place to add is not decided, but I think it would be nice to put it after the 1388th line. --___ I wrote an if statement in other parts of the Dockerfile, but I didn't understand this part a little, so the if statement is broken. I would appreciate it if you could tell me the details. ___
###########################################################################
# Fish:
###########################################################################
RUN apt-get install -y fish
RUN git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
RUN ~/.fzf/install
RUN curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish
RUN ["/usr/bin/fish", "-c", "fisher add jethrokuan/fzf"]
RUN cp /root/.fzf/bin/fzf /usr/bin/
COPY config.fish /root/.config/fish/
###########################################################################
# .vimrc:
###########################################################################
COPY ./.vimrc /root/
cp env-example .env
vim .env
--Edit APP_CODE_PATH_HOST as APP_CODE_PATH_HOST = ../ project name` ``. --If you want to specify the php version, edit __PHP_VERSION__. --The version is listed as
# Accepted values: 7.4 --7.3 --7.2 --7.1 --7.0 --5.6on the previous line, so be sure to specify it from among them. --___ When using mysql ___ --Edit __PMA_PORT__ as
PMA_PORT = 8081```
--Anything is fine as long as it does not collide with other ports.
--If you don't know the port well, you can set it to 8081 for the time being.
--Edit MYSQL_VERSION as MYSQL_VERSION = 5.7
.
――If mysql is 8 series, I encountered an error, so if you are not particular about it, 5.7 is safe.
--Please change MYSQL_DATABASE, MYSQL_USER, MYSQL_PASSWORD to laravel.
――You can freely specify here.
--___ When using postgresql ___
--Please change POSTGRERS_DATABASE, POSTGRES_USER, POSTGRES_PASSWORD to laravel.
――It's okay to specify here as well.
――Thank you for your hard work. Finally start the container. --Here, start nginx and mysql. Make sure the current directory is in laradock.
docker-compose up -d nginx mysql
――This time, I will put in 8 series. --If you like other versions, please check the version specification method.
docker-compose exec workspace composer create-project laravel/laravel ./
--Since you specified ```APP_CODE_PATH_HOST = ../ project name` `` in APP_CODE_PATH_HOST, let's check if the project directory has been created.
ls ..
--Also, let's check the created directory.
ls ../Project name
○ OK if the following is displayed
README.md bootstrap/ config/ phpunit.xml routes/ tests/
app/ composer.json database/ public/ server.php vendor/
artisan* composer.lock package.json resources/ storage/ webpack.mix.js
cd ../Project name
vim .env
--When using mysql
DB_CONNECTION=mysql
--When using pgsql
DB_CONNECTION=pgsql
--Change DB_HOST from 127.0.0.1
to laradock_mysql_1
.
--The host name must be the container name.
--When connecting from a DB client (mysql workbench, table plus, dbeaver, etc.), specify 127.0.0.1
.
--Change DB_DATABASE, DB_USER, DB_PASSWORD to the values you specified earlier.
--If you follow the article, it's all laravel.
--If it doesn't work, try changing the user and password to root.
cd ../laradock
docker-compose exec workspace php artisan migrate
○ OK if the following is displayed
Nothing to migrate.
-Please complete the docker settings from this article.
--Right-click workspace from Containers on the left side of the image below and select exec. --Enter fish as you will be prompted to create a new command. --You can now work with the workspace container in the fish shell.
――Please feel free to comment on any questions or improvements. ――I will reply if you feel like it.
Recommended Posts