Skip to content

Commit ea8844c

Browse files
authored
Merge pull request #45 from JaccoVE/master
Support for Docker #23
2 parents 874a539 + d44e2a9 commit ea8844c

File tree

6 files changed

+95
-0
lines changed

6 files changed

+95
-0
lines changed

.dockerignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.github
2+
docs/
3+
github-contents/
4+
tests/
5+
.gitattributes
6+
.gitignore
7+
buildDocker.sh
8+
docker-compose.yml
9+
readme-logo.png
10+
README.md
11+

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99
/.github export-ignore
1010
CHANGELOG.md export-ignore
1111
.styleci.yml export-ignore
12+
13+
run.sh text eol=lf

buildDocker.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker build --network=host -t devaslanphp/helper:latest .

docker-compose.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
version: "3.3"
2+
3+
volumes:
4+
mysql_data:
5+
6+
services:
7+
sqldb:
8+
image: mysql:5.7
9+
container_name: helper-mysql
10+
volumes:
11+
- mysql_data:/var/lib/mysql
12+
environment:
13+
- MYSQL_DATABASE=helper
14+
- MYSQL_USER=helper
15+
- MYSQL_PASSWORD=helper
16+
- MYSQL_ROOT_PASSWORD=helper
17+
command: --default-storage-engine innodb
18+
restart: unless-stopped
19+
healthcheck:
20+
test: mysqladmin -p$$MYSQL_ROOT_PASSWORD ping -h localhost
21+
interval: 20s
22+
start_period: 10s
23+
timeout: 10s
24+
retries: 3
25+
helper:
26+
image: devaslanphp/helper:latest
27+
container_name: helper-server
28+
environment:
29+
- DB_CONNECTION=mysql
30+
- DB_HOST=sqldb
31+
- DB_PORT=3306
32+
- DB_DATABASE=helper
33+
- DB_USERNAME=helper
34+
- DB_PASSWORD=helper
35+
- MAIL_MAILER=smtp
36+
- MAIL_HOST=smtp.mailtrap.io
37+
- MAIL_PORT=2525
38+
- MAIL_USERNAME=your_username
39+
- MAIL_PASSWORD=your_password
40+
- MAIL_ENCRYPTION=tls
41+
depends_on:
42+
- sqldb
43+
restart: "no"
44+
ports:
45+
- 8000:8000
46+
volumes:
47+
- /etc/localtime:/etc/localtime

dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# syntax=docker/dockerfile:1
2+
3+
#Deriving the latest base image
4+
FROM node:16.17.0-bullseye-slim
5+
6+
# Any working directory can be chosen as per choice like '/' or '/home' etc
7+
WORKDIR /app
8+
9+
COPY .env.example .env
10+
11+
COPY . .
12+
13+
RUN apt-get update -y && \
14+
apt-get install -y --no-install-recommends software-properties-common gnupg2 wget && \
15+
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/sury-php.list && \
16+
wget -qO - https://packages.sury.org/php/apt.gpg | apt-key add - && \
17+
apt-get update -y && \
18+
apt-get install -y --no-install-recommends php8.1 php8.1-curl php8.1-xml php8.1-zip php8.1-gd php8.1-mbstring php8.1-mysql && \
19+
apt-get update -y && \
20+
apt-get install -y composer && \
21+
composer update && \
22+
composer install && \
23+
npm install && \
24+
php artisan key:generate && \
25+
rm -rf /var/lib/apt/lists/*
26+
27+
CMD [ "bash", "./run.sh"]

run.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
php artisan queue:work &
3+
php artisan migrate
4+
php artisan db:seed
5+
npm run build
6+
php artisan optimize:clear
7+
php artisan serve --host 0.0.0.0

0 commit comments

Comments
 (0)