Skip to content

Commit

Permalink
chore: primeira versão
Browse files Browse the repository at this point in the history
  • Loading branch information
caduvieira committed May 7, 2024
0 parents commit e01aeb3
Show file tree
Hide file tree
Showing 10 changed files with 328 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/dockerhub-description.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Update Docker Hub Description
on:
push:
branches:
- main
paths:
- README.md
- .github/workflows/dockerhub-description.yml
jobs:
dockerHubDescription:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: processoeletronico/sei5-alpine
short-description: ${{ github.event.repository.description }}
enable-url-completion: true
43 changes: 43 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: ci

on:
push:
branches:
- "main"
paths:
- 'Dockerfile'
- 'assets/**'
- '.github/workflows/publish.yml'
tags:
- "*.*.*"
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
processoeletronico/sei5-alpine
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=pep440,pattern={{major}}.{{minor}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
97 changes: 97 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
################################################################################
# Dockerfile de construcao do container APP com os pacotes basicos
################################################################################

FROM almalinux:9

LABEL \
org.opencontainers.image.title="Imagem docker para SEI 5 em php"

RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm; \
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm; \
dnf module install -y php:remi-8.2

RUN dnf --enablerepo=crb install -y aspell
RUN dnf install -y \
php-mbstring \
php-bcmath \
php-bz2 \
php-calendar \
php-ctype \
php-curl \
php-dom \
php-exif \
php-fileinfo \
php-gd \
php-gettext \
php-gmp \
php-iconv \
php-imap \
php-intl \
php-ldap \
php-mbstring \
php-mysqli \
php-odbc \
php-openssl \
php-pcntl \
php-pdo \
php-pear \
php-pecl-apcu \
php-pecl-igbinary \
php-pecl-mcrypt \
php-pecl-memcache \
php-pecl-xdebug \
php-pgsql \
php-phar \
php-pspell \
php-simplexml \
php-sodium \
php-shmop \
php-snmp \
php-soap \
php-xml \
php-zip \
php-zlib \
php-pecl-uploadprogress; \
dnf install -y \
httpd \
xorg-x11-fonts-75dpi \
xorg-x11-fonts-Type1 \
libpng \
libjpeg \
openssl \
icu \
libX11 \
libXext \
libXrender; \
dnf install -y wget ; \
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox-0.12.6.1-2.almalinux9.x86_64.rpm ; \
dnf install -y ./wkhtmltox-0.12.6.1-2.almalinux9.x86_64.rpm; \
rm -f ./wkhtmltox-0.12.6.1-2.almalinux9.x86_64.rpm; \
dnf install -y glibc-locale-source; \
dnf install -y java-1.8.0-openjdk; \
dnf clean all;

COPY assets/sei.ini /etc/php.d/99_sei.ini
COPY assets/sei.ini /etc/php-fpm.d/99_sei.ini
COPY assets/xdebug.ini /etc/php.d/99_xdebug.ini
COPY assets/sei.conf /etc/httpd/conf.d/

# Pasta para arquivos externos
RUN mkdir -p /var/sei/arquivos && chown -R apache.apache /var/sei/arquivos && chmod 777 /tmp

RUN mkdir -p /var/log/sei && mkdir -p /var/log/sip
RUN sed -e 's/127.0.0.1:9000/9000/' \
-e '/allowed_clients/d' \
-e '/catch_workers_output/s/^;//' \
-e '/error_log/d' \
-e 's/;clear_env = no/clear_env = no/' \
-i /etc/php-fpm.d/www.conf

RUN mkdir -p /run/php-fpm
RUN localedef pt_BR -i pt_BR -f ISO-8859-1 ; \
localedef pt_BR.ISO-8859-1 -i pt_BR -f ISO-8859-1 ; \
localedef pt_BR.ISO8859-1 -i pt_BR -f ISO-8859-1

EXPOSE 8000
CMD ["bash", "-c", "php-fpm && httpd -DFOREGROUND"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 PEN - Processo Eletrônico Nacional

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# sei5-alma9

Imagem docker para SEI 5 no PHP82 no Alma9 - Versão DEV

Essa imagem serve somente para MySQL, MariaDB e Postgres.

Bancos de oracle e sqlserver não tem suporte.

Cron não instalado.
2 changes: 2 additions & 0 deletions assets/cron.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* * * * * /usr/bin/php /opt/sei/scripts/AgendamentoTarefaSEI.php 2>&1 >> /var/log/sei/agendamento_sei.log
* * * * * /usr/bin/php /opt/sip/scripts/AgendamentoTarefaSip.php 2>&1 >> /var/log/sip/agendamento_sip.log
57 changes: 57 additions & 0 deletions assets/pdo_client_info.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php
$serverName = "database";
$connectionOptions = array(
"database" => "sei",
"uid" => "sei_user",
"pwd" => "sei_user"
);

function exception_handler($exception) {
echo "<h1>Failure</h1>";
echo "Uncaught exception: " , $exception->getMessage();
echo "<h1>PHP Info for troubleshooting</h1>";
phpinfo();
}

set_exception_handler('exception_handler');

// Establishes the connection
$conn = sqlsrv_connect($serverName, $connectionOptions);
if ($conn === false) {
die(formatErrors(sqlsrv_errors()));
}

// Select Query
$tsql = "SELECT @@Version AS SQL_VERSION";

// Executes the query
$stmt = sqlsrv_query($conn, $tsql);

// Error handling
if ($stmt === false) {
die(formatErrors(sqlsrv_errors()));
}
?>

<h1> Success Results : </h1>

<?php
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
echo $row['SQL_VERSION'] . PHP_EOL;
}

sqlsrv_free_stmt($stmt);
sqlsrv_close($conn);

function formatErrors($errors)
{
// Display errors
echo "<h1>SQL Error:</h1>";
echo "Error information: <br/>";
foreach ($errors as $error) {
echo "SQLSTATE: ". $error['SQLSTATE'] . "<br/>";
echo "Code: ". $error['code'] . "<br/>";
echo "Message: ". $error['message'] . "<br/>";
}
}
?>
50 changes: 50 additions & 0 deletions assets/sei.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Listen 8000
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15

Alias "/sei" "/opt/sei/web"
Alias "/sip" "/opt/sip/web"
Alias "/infra_css" "/opt/infra/infra_css"
Alias "/infra_js" "/opt/infra/infra_js"

SetEnvIfNoCase user-agent "Microsoft Data Access Internet Publishing Provider Protocol Discovery" bad_bot=1

<FilesMatch "(.*)">
Order Allow,Deny
Allow from all
Deny from env=bad_bot
</FilesMatch>

<VirtualHost *:8000>
DocumentRoot /var/www/html
ServerAdmin [email protected]
ServerName localhost

# Enable http authorization headers


DirectoryIndex index.php index.html
IndexIgnore *
EnableSendfile Off
HostnameLookups Off
ServerSignature Off
AddDefaultCharset iso-8859-1

<Directory />
AllowOverride None
Require all denied
</Directory>

<Directory ~ "(/opt/sei/web|/opt/sip/web|/opt/infra/infra_css|/opt/infra/infra_js)" >
AllowOverride None
Options None
Require all granted
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1

<FilesMatch \.(php|phar)$>
SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"
</FilesMatch>
</Directory>

</VirtualHost>
20 changes: 20 additions & 0 deletions assets/sei.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[php]
; Parâmetros recomendados no Manual de Instalação
include_path = ".:/php/includes:/opt/infra/infra_php"
default_charset = "iso-8859-1"
session.gc_maxlifetime = 28800
short_open_tag = On
default_socket_timeout = 60
max_input_vars = 2000
magic-quotes-gpc = 0
magic_quotes_runtime = 0
magic_quotes_sybase = 0
post_max_size = 110M
upload_max_filesize = 100M

; Parâmetros recomendados para ambiente de desenvolvimento
error_reporting = E_ALL
display_errors = On
display_startup_errors = On
html_errors = On
always_populate_raw_post_data = -1
7 changes: 7 additions & 0 deletions assets/xdebug.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.client_host=localhost
xdebug.client_port=9003
xdebug.remote_handler=dbgp
xdebug.discover_client_host=1
xdebug.idekey=default

0 comments on commit e01aeb3

Please sign in to comment.