使用Gitlab CI, Docker部屬Laravel專案

GitLab本身功能非常豐富,加上它又是open source可以自行架設,從8.0開始支援CI功能,只要在project root裡面新增一個.gitlab-ci.yml,就可以啟用GitLab CI功能。GitLab也提供預設Shared Runners執行CI jobs,除此之外也可以自定義註冊Specific Runners給特定專案使用。

Docker 常用指令

Docker Login docker login [OPTIONS] [SERVER] 1 2 docker login docker login registry.gitlab.com Docker pull docker pull [OPTIONS] NAME[:TAG|@DIGEST] 1 2 3 4 docker pull gitlab/gitlab-ce:latest docker pull php:7.2 docker pull mysql:5.6 docker pull registry.gitlab.com/scottchayaa/laravel-ci:latest Docker build docker build [OPTIONS] PATH | URL | - 1 docker build -t example:latest . How to use –build-arg in Dockerfile 1 2 3 docker build \ --build-arg TMP_DIR=tmp_example1 \ -t example:latest . Dockerfile

Setting Automated Build on Docker Hub

Automated Build Automated Build 是 Docker Hub 提供的功能 當你update push Dockerfile to Github repo 時 就馬上根據 Dockerfile 幫你 build 一個新的 image:tag step1: 首先到 Docker Hub 右上角點選 Create Automated Build step2: 設定帳戶與Github連結 step3: 選

Install docker on Ubuntu16.04

Installing Docker CE AWS EC2 user : ubuntu Install using the repository 1 2 3 4 5 6 7 8 9 10 $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - $ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs)stable" $ sudo apt-get update $ sudo apt-get install docker-ce docker-ce-cli containerd.io # Verify that Docker CE is installed correctly by running the hello-world image. $ sudo docker run hello-world Install using