Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dockerfile for easy installation on local machine #532

Merged
merged 24 commits into from
Jul 10, 2022
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/deploy-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Docker Image CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Buildx
uses: docker/setup-buildx-action@v1

- name: Login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: amirpourmand/ai-folio
pourmand1376 marked this conversation as resolved.
Show resolved Hide resolved
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM jekyll/jekyll
Label MAINTAINER Amir Pourmand
pourmand1376 marked this conversation as resolved.
Show resolved Hide resolved
#install imagemagick tool for convert command
RUN apk add --no-cache --virtual .build-deps \
libxml2-dev \
shadow \
autoconf \
g++ \
make \
&& apk add --no-cache imagemagick-dev imagemagick
WORKDIR /srv/jekyll
ADD Gemfile /srv/jekyll/
RUN bundle install
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,45 @@ Why Jekyll? Read [Andrej Karpathy's blog post](https://karpathy.github.io/2014/0

### Installation

#### Local setup
#### Local setup using Docker (Recommended)
pourmand1376 marked this conversation as resolved.
Show resolved Hide resolved

You need to do these step to get `ai-folio` up and running in your local machine:

- Install [docker](https://docs.docker.com/get-docker/)
- Clone your repository

```bash
git clone git@github.com:<your-username>/<your-repo-name>.git
cd <your-repo-name>
```

Then you can use Dockerhub prebuilt image to run your website. Note that for the first time it would download an image of size 300MB or so.

```bash
bin/dockerhub_run.sh
```

##### More Advanced Users
You can also build your own docker image.

So first, download necessary modules and install them into a docker image called `mywebsite:Dockerfile` (this command will build an image which is used to run your website afterwards. Note that you only need to do this step once. After you have the image, you no longer need to do this anymore):


```bash
bin/docker_build_image.sh
```

Run the website!

```bash
bin/docker_run.sh
```

> In order to change port number, you can change `docker_run.sh` file.

> If you want to update jekyll or install new ruby packages or ... , all you have to do is to build the image again using `docker_build_image.sh`! It will download ruby and jekyll and installall ruby packages again.
pourmand1376 marked this conversation as resolved.
Show resolved Hide resolved

#### Local Setup (Legacy mode)
pourmand1376 marked this conversation as resolved.
Show resolved Hide resolved

Assuming you have [Ruby](https://www.ruby-lang.org/en/downloads/) and [Bundler](https://bundler.io/) installed on your system (*hint: for ease of managing ruby gems, consider using [rbenv](https://github.com/rbenv/rbenv)*), first [fork](https://guides.github.com/activities/forking/) the theme from `github.com:alshedivat/al-folio` to `github.com:<your-username>/<your-repo-name>` and do the following:

Expand Down
1 change: 1 addition & 0 deletions bin/docker_build_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker build -t "mywebsite:Dockerfile" .
pourmand1376 marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions bin/docker_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docker run --rm -v "$PWD:/srv/jekyll/" -p "8080:8080" \
-it mywebsite:Dockerfile bundler \
pourmand1376 marked this conversation as resolved.
Show resolved Hide resolved
exec jekyll serve --watch --port=8080 --host=0.0.0.0
3 changes: 3 additions & 0 deletions bin/dockerhub_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docker run --rm -v "$PWD:/srv/jekyll/" -p "8080:8080" \
-it amirpourmand/ai-folio bundler \
pourmand1376 marked this conversation as resolved.
Show resolved Hide resolved
exec jekyll serve --watch --port=8080 --host=0.0.0.0