Skip to content

Commit

Permalink
chore: adiciona primeira versão Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
caduvieira committed May 2, 2024
1 parent c16c270 commit d6a384c
Show file tree
Hide file tree
Showing 6 changed files with 224 additions and 0 deletions.
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 alpine:3.19

RUN apk add --no-cache \
apache2 \
apache2-http2 \
gnu-libiconv \
php82-apache2 \
php82-bcmath \
php82-bz2 \
php82-calendar \
php82-ctype \
php82-curl \
php82-dom \
php82-exif \
php82-fileinfo \
php82-gd \
php82-gettext \
php82-gmp \
php82-iconv \
php82-imap \
php82-intl \
php82-ldap \
php82-mbstring \
php82-mysqli \
php82-odbc \
php82-openssl \
php82-pcntl \
php82-pdo \
php82-pear \
php82-pecl-apcu \
php82-pecl-igbinary \
php82-pecl-mcrypt \
php82-pecl-memcache \
php82-pecl-xdebug \
php82-pgsql \
php82-phar \
php82-pspell \
php82-simplexml \
php82-sodium \
php82-shmop \
php82-snmp \
php82-soap \
php82-xml \
php82-zip \
php82-zlib \
php82-pecl-uploadprogress;

# Pacotes para o wkhtmltopdf
RUN apk add --no-cache \
libstdc++ \
libx11 \
libxrender \
libxext \
libssl3 \
ca-certificates \
fontconfig \
freetype \
ttf-dejavu \
ttf-droid \
ttf-freefont \
ttf-liberation \
# more fonts
&& apk add --no-cache --virtual .build-deps \
msttcorefonts-installer \
# Install microsoft fonts
&& update-ms-fonts \
&& fc-cache -f \
# Clean up when done
&& rm -rf /tmp/* \
&& apk del .build-deps

# wkhtmltopdf #
COPY --from=surnet/alpine-wkhtmltopdf:3.19.1-0.12.6-small \
/bin/wkhtmltopdf /bin/wkhtmltopdf

RUN apk add --no-cache openjdk8

COPY assets/sei.ini /etc/php82/conf.d/99_sei.ini
COPY assets/xdebug.ini /etc/php82/conf.d/99_xdebug.ini
COPY assets/sei.conf /etc/apache2/conf.d/
COPY assets/cron.conf /tmp/cron.conf
RUN cat /tmp/cron.conf >> /etc/crontabs/root

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

RUN mkdir -p /var/log/sei && mkdir -p /var/log/sip
# Suporte para atualização do SEI. O script de atualização do SEI está fixo no bash
RUN apk add --no-cache \
bash curl;

EXPOSE 80
CMD ["sh", "-c", "crond && httpd -DFOREGROUND"]
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/>";
}
}
?>
41 changes: 41 additions & 0 deletions assets/sei.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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

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
</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 d6a384c

Please sign in to comment.