Skip to content
Open

Dev #413

Show file tree
Hide file tree
Changes from all 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
29 changes: 29 additions & 0 deletions docker-nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM alpine:latest

RUN apk update
RUN apk --no-cache add nginx php83-mbstring php83-fpm php83-mysqli php82-mysqlnd php83-session curl unzip

WORKDIR /work

RUN curl -O https://labs.fi/files/mlinvoice-2.1.2.zip
RUN unzip mlinvoice-2.1.2.zip
RUN rm mlinvoice-2.1.2.zip

RUN sed -ri \
-e "s/^user = nobody/user = www/" \
-e "s/^group = nobody/group = www/" /etc/php83/php-fpm.d/www.conf


RUN addgroup -g 2024 www
RUN adduser -S -D www -G www

RUN chown www:www /work/mlinvoice /work/mlinvoice/config.*

COPY config.php.sample /work/mlinvoice/config.php.sample
COPY mlinvoice-nginx.conf /etc/nginx/nginx.conf
COPY entrypoint /work/entrypoint

EXPOSE 80


ENTRYPOINT ["sh", "/work/entrypoint"]
19 changes: 19 additions & 0 deletions docker-nginx/config.php.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?

// ote config.php.sample:n alusta

// Database server address
// Tietokantapalvelimen osoite
define('_DB_SERVER_', 'db');

// Database server user id
// Tunnus tietokantapalvelimelle
define('_DB_USERNAME_', 'mlinvoice');

// Database server password
// Salasana tietokantapalvelimelle
define('_DB_PASSWORD_', 'mlinvoice');

// Database name
// Tietokannan nimi
define('_DB_NAME_', 'mlinvoice');
19 changes: 19 additions & 0 deletions docker-nginx/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
services:
mlinvoice:
container_name: mlinvoice
build: .
ports:
- '8888:80'
db:
image: mysql:latest
restart: always
environment:
MYSQL_DATABASE: 'mlinvoice'
MYSQL_USER: 'mlinvoice'
MYSQL_PASSWORD: 'mlinvoice'
MYSQL_ROOT_PASSWORD: 'password'
volumes:
- my-db:/var/lib/mysql
- ./init-script.sql:/docker-entrypoint-initdb.d/init-script.sql
volumes:
my-db:
3 changes: 3 additions & 0 deletions docker-nginx/entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
php-fpm83 &
nginx
3 changes: 3 additions & 0 deletions docker-nginx/init-script.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE DATABASE iF NOT EXISTS mlinvoice;
GRANT ALL PRIVILEGES ON mlinvoice.* TO 'mlinvoice'@'%';
ALTER USER 'mlinvoice' IDENTIFIED WITH mysql_native_password BY 'mlinvoice';
28 changes: 28 additions & 0 deletions docker-nginx/mlinvoice-nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
user nobody;
worker_processes 2;
error_log /dev/stdout;

events {
worker_connections 1024;
}
http {
default_type application/octet-sream;
include mime.types;
server_names_hash_bucket_size 128;
client_max_body_size 3M;
charset utf-8;
server {
listen 80;
root /work/mlinvoice;
location / {
index index.php index.html;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
}
}
daemon off;