-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
5 changed files
with
104 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Dockerfile.dojo-scavenger | ||
FROM php:7.4-apache | ||
|
||
# Install SQLite and PHP SQLite extension | ||
RUN apt-get update && apt-get install -y sqlite3 libsqlite3-dev | ||
RUN docker-php-ext-install pdo pdo_sqlite | ||
|
||
# Set environment variable for database type | ||
ENV DOJO_DB_TYPE sqlite | ||
|
||
# Create the db directory and set permissions | ||
RUN mkdir -p /var/www/html/db && \ | ||
chmod 755 /var/www/html/db | ||
|
||
# Copy application files | ||
COPY ./src/scavenger /var/www/html | ||
|
||
# Add error logging | ||
RUN echo "error_reporting = E_ALL" >> /usr/local/etc/php/php.ini && \ | ||
echo "display_errors = On" >> /usr/local/etc/php/php.ini && \ | ||
echo "log_errors = On" >> /usr/local/etc/php/php.ini && \ | ||
echo "error_log = /var/log/php_errors.log" >> /usr/local/etc/php/php.ini | ||
|
||
# Run init db script | ||
RUN php /var/www/html/init_lite_db.php | ||
|
||
LABEL org.opencontainers.image.source=https://github.com/SamuraiWTF/samurai-dojo | ||
LABEL org.opencontainers.image.description="Basic PHP 7.4-apache image with dojo-scavenger and SQLite/MySQL support." | ||
LABEL org.opencontainers.image.licenses="lgpl" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: '3' | ||
services: | ||
dojo-scavenger-lite: | ||
build: | ||
context: .. | ||
dockerfile: .shogun/Dockerfile.dojo-scavenger-lite | ||
ports: | ||
- "8081:80" | ||
environment: | ||
- DOJO_DB_TYPE=sqlite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
$sqlite_db = '/var/www/html/db/scavenger.sqlite'; | ||
$db = new SQLite3($sqlite_db); | ||
|
||
// Create table | ||
$db->exec("CREATE TABLE IF NOT EXISTS partners_data ( | ||
partner_id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
username TEXT, | ||
password TEXT | ||
)"); | ||
|
||
// Insert initial data | ||
$db->exec("INSERT OR IGNORE INTO partners_data (username, password) VALUES | ||
('kevin', 'brenna'), | ||
('justin', 'meeas'), | ||
('key13', 'ed265bc903a5a097f61d3ec064d96d2e'), | ||
('key', 'boomerang')"); | ||
|
||
echo "Database initialized successfully."; | ||
$db->close(); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters