Skip to content

Commit

Permalink
Update dockerisation procedures to work on M1 Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
huyuxin0429 committed Dec 3, 2023
1 parent 0ae736c commit 549a184
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN javac -version
# install ant
RUN apt update
RUN apt -y install ant
RUN ant -version
# RUN ant -version # Causes issues with docker build

# install antlr
WORKDIR /usr/local/lib
Expand Down
2 changes: 1 addition & 1 deletion config/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.7"
services:
db:
image: "mysql:5.7"
image: "mariadb:10.4" # Equivalent to mysql:5.7 and works on M1 Macs
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
Expand Down
20 changes: 14 additions & 6 deletions doc/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,27 @@ This guide will list the steps required to setup the application using Docker.

### Prerequisites

Please ensure that you have downloaded Docker in your local machine. When you open the Docker web application, the application should be displaying a green icon on the bottom left with the hover text, "Running".
Please ensure that you have downloaded Docker in your local machine. Docker can be installed from https://www.docker.com/products/docker-desktop/. When you open the Docker web application, the application should be displaying a green icon on the bottom left with the hover text, "Running".

### Set-up commands
1. Clone SSID's source code onto your computer
<pre>git clone https://github.com/WING-NUS/SSID.git</pre>
2. Copy config/database.docker.yml to config/database.yml
3. Open a terminal and under the application root directory, run the below command:
2. Copy all the contents from config/database.docker.yml to replace all the contents of config/database.yml.
3. From here on, if any of the commands fail, try adding sudo in front of the commands (for Mac/Linux systems). For Windows systems, try running the commands in an administrator command prompt.
4. Open a terminal and under the application root directory, run the command below:
<pre>docker build .</pre>
4. Next run the below commands:
5. Next run the below commands:
<pre>cd config/
docker-compose run web bundle install
docker-compose run web rails db:setup
docker-compose build
docker-compose up</pre>
5. Go to 127.0.0.1:3000 in the browser to see the login interface
6. Login with username `admin` and password `$$SSIDPassword$$`
6. Go to 127.0.0.1:3000 in the browser to see the login interface
7. Login with username `[email protected]` and password `SSIDPassword123!`

### Shutting down the application
1. To shut down the application, press Ctrl+C in the terminal where the application is running.

### Turning on the application
1. To turn on the application, run the command below:
<pre>docker-compose up</pre>

0 comments on commit 549a184

Please sign in to comment.