add initial files

This commit is contained in:
albjeremias 2021-02-12 12:59:50 +00:00
parent 41a0712773
commit 88cbce57a0
4 changed files with 128 additions and 0 deletions

23
Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM debian:buster-slim
ENV DEBIAN_FRONTEND noninteractive
WORKDIR /app/
RUN apt update
RUN apt -y install nginx php php-fpm php-mysql nano curl php-xml cron php-curl php-gd php-mbstring composer php-imagick git
RUN git clone https://github.com/opensourcepos/opensourcepos/ /opensourcepos/
RUN ln -s /opensourcepos/application/ /application
RUN ln -s /opensourcepos/public/ /app
RUN ln -s /opensourcepos/vendor/ /vendor
RUN cd /opensourcepos/ && composer required
COPY nginx.conf /etc/nginx/sites-available/
RUN ln -sf /etc/nginx/sites-available/nginx.conf /etc/nginx/sites-enabled/default
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 80
ENTRYPOINT ["/entrypoint.sh"]

56
docker-compose.yml Normal file
View File

@ -0,0 +1,56 @@
version: '3.4'
services:
ospos:
build:
context: .
target: ospos
container_name: ospos
restart: always
labels:
- traefik.frontend.rule=Host:pos.coletivos.org
- traefik.enable=true
depends_on:
- mysql
expose:
- "80"
ports:
- "4001:80"
networks:
- world
- internal
volumes:
- uploads:/app/public/uploads:rw
- logs:/app/application/logs:rw
environment:
- FORCE_HTTPS=true
- PHP_TIMEZONE=UTC
- MYSQL_USERNAME=${OSPOS_MYSQL_USERNAME}
- MYSQL_PASSWORD=${OSPOS_MYSQL_PASSWORD}
- MYSQL_DB_NAME=ospos
- MYSQL_HOST_NAME=mysql
mysql:
image: mariadb:10.5
container_name: mysql
restart: always
labels:
- traefik.enable=false
expose:
- "3306"
networks:
- internal
volumes:
- ./database/database.sql:/docker-entrypoint-initdb.d/database.sql:ro
- db:/var/lib/mysql:rw
environment:
- MYSQL_ROOT_PASSWORD=${OSPOS_MYSQL_ROOT_PASSWORD}
- MYSQL_DATABASE=ospos
- MYSQL_USER=${OSPOS_MYSQL_USERNAME}
- MYSQL_PASSWORD=${OSPOS_MYSQL_PASSWORD}
networks:
world:
external: true
internal:
external: false

5
entrypoint.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
service nginx start
service php7.3-fpm start
sleep 2
tail -f /var/log/nginx/*.log

44
nginx.conf Normal file
View File

@ -0,0 +1,44 @@
# Designed to be included in any server {} block.
# Upstream to abstract backend connection(s) for php
upstream php {
# server unix:/tmp/php-cgi.socket;
server unix:/var/run/php/php7.3-fpm.sock;
}
server {
## Your website name goes here.
server_name _;
## Your only path reference.
root /app/public/;
## This should be in your http block and if it is, it's not needed here.
index index.php;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
# This is cool because no php is touched for static content.
# include the "?$args" part so non-default permalinks doesn't break when using query string
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_pass php;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}