Skip to content

Commit

Permalink
Merge branch 'dockerize-local-states-nepal' into add-php-stan
Browse files Browse the repository at this point in the history
  • Loading branch information
sagautam5 committed Apr 21, 2024
2 parents 7bdce82 + 9d9f067 commit 0985dc7
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 4 deletions.
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM php:7.1-fpm

RUN apt-get update && apt-get upgrade -y &&\
apt-get install -y git && \
apt-get install -y unzip && \
apt-get install -y vim

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
ENV PATH="${PATH}:/root/.composer/vendor/bin"
8 changes: 4 additions & 4 deletions demo/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function reloadProvinces(lang)
$('.ward').find("option:gt(0)").remove();
$.ajax({
url: '/local-states-nepal/demo/api/provinces.php?lang='+lang,
url: 'api/provinces.php?lang='+lang,
type: 'GET',
dataType: 'json',
}).done(function (data) {
Expand All @@ -104,7 +104,7 @@ function reloadProvinces(lang)
$('.ward').find("option:gt(0)").remove();
var selected = $(this).find(":selected").attr('value');
$.ajax({
url: '/local-states-nepal/demo/api/districts.php?lang='+lang+'&&province_id=' + selected,
url: 'api/districts.php?lang='+lang+'&&province_id=' + selected,
type: 'GET',
dataType: 'json',
}).done(function (data) {
Expand All @@ -120,7 +120,7 @@ function reloadProvinces(lang)
$('.ward').find("option:gt(0)").remove();
var selected = $(this).find(":selected").attr('value');
$.ajax({
url: '/local-states-nepal/demo/api/municipalities.php?lang='+lang+'&&district_id=' + selected,
url: 'api/municipalities.php?lang='+lang+'&&district_id=' + selected,
type: 'GET',
dataType: 'json',
}).done(function (data) {
Expand All @@ -135,7 +135,7 @@ function reloadProvinces(lang)
var selected = $(this).find(":selected").attr('value');
$('.ward').find("option:gt(0)").remove();
$.ajax({
url: '/local-states-nepal/demo/api/wards.php?lang='+lang+'&&municipality_id=' + selected,
url: 'api/wards.php?lang='+lang+'&&municipality_id=' + selected,
type: 'GET',
dataType: 'json',
}).done(function (data) {
Expand Down
35 changes: 35 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: '1.0'
services:
localstates:
build:
context: ./
dockerfile: Dockerfile
image: localstates
working_dir: /var/www/html/
volumes:
- ./:/var/www/html
expose:
- 9000
tty: true
restart: unless-stopped
container_name: localstates
networks:
- lsn

nginx:
image: nginx:alpine-slim
volumes:
- ./:/var/www/html
- ./localstates.conf:/etc/nginx/conf.d/localstates.conf
ports:
- 80:80
depends_on:
- localstates
container_name: lsn_nginx
restart: unless-stopped
tty: true
networks:
- lsn
networks:
lsn:
driver: bridge
18 changes: 18 additions & 0 deletions localstates.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
server {
listen 80;
server_name localstates.test www.localstates.test;

root /var/www/html/demo;

location / {
index index.php index.html;
}

location ~* \.php$ {
fastcgi_pass localstates:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}

0 comments on commit 0985dc7

Please sign in to comment.