Skip to content

Commit

Permalink
2Fauth-docker: init
Browse files Browse the repository at this point in the history
  • Loading branch information
tomMoulard committed Jan 10, 2021
0 parents commit 35e23a6
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
@@ -0,0 +1,5 @@
.*.swp

postgres/
redis/
db/
64 changes: 64 additions & 0 deletions Dockerfile
@@ -0,0 +1,64 @@
FROM composer:2.0

WORKDIR /2fauth

RUN chown 1000:1000 /2fauth

USER 1000:1000

# $(php artisan key:generate) || $(head -c32 /dev/urandom | base64)
# ENV DB_CONNECTION=sqlite
# ENV DB_DATABASE="/2fauth/database/database.sqlite"

ENV APP_NAME=2FAuth \
APP_ENV=local \
APP_DEBUG=false \
SITE_OWNER=mail@example.com \
APP_KEY=SomeRandomStringOf32CharsExactly \
APP_URL=http://localhost \
IS_DEMO_APP=false \
LOG_CHANNEL=daily \
APP_LOG_LEVEL=notice \
DB_CONNECTION=mysql \
DB_HOST=127.0.0.1 \
DB_PORT=3306 \
DB_DATABASE=homestead \
DB_USERNAME=homestead \
DB_PASSWORD=secret \
CACHE_DRIVER=file \
SESSION_DRIVER=file \
MAIL_DRIVER=log \
MAIL_HOST=smtp.mailtrap.io \
MAIL_PORT=2525 \
MAIL_FROM=changeme@example.com \
MAIL_USERNAME=null \
MAIL_PASSWORD=null \
MAIL_ENCRYPTION=null \
MAIL_FROM_NAME=null \
MAIL_FROM_ADDRESS=null \
BROADCAST_DRIVER=log \
QUEUE_DRIVER=sync \
SESSION_LIFETIME=12 \
REDIS_HOST=127.0.0.1 \
REDIS_PASSWORD=null \
REDIS_PORT=6379 \
PUSHER_APP_ID= \
PUSHER_APP_KEY= \
PUSHER_APP_SECRET= \
PUSHER_APP_CLUSTER=mt1 \
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" \
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" \
MIX_ENV=local

RUN git clone -q https://github.com/Bubka/2FAuth /2fauth

COPY ./startup.sh .

RUN composer -q install

RUN mkdir -p database/ && touch database/database.sqlite

RUN php artisan config:cache
RUN php artisan storage:link

ENTRYPOINT ["/2fauth/startup.sh"]
8 changes: 8 additions & 0 deletions Makefile
@@ -0,0 +1,8 @@
all: build
all: up

build:
docker-compose build

up:
docker-compose up
3 changes: 3 additions & 0 deletions README.md
@@ -0,0 +1,3 @@
# 2FAuth docker

A repo with project to bring Docker support to [2Fauth](https://github.com/Bubka/2FAuth)
51 changes: 51 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,51 @@
version: '3.6'

networks:
2fauth-internal:

services:
2fauth:
image: tommoulard/2fauth
build: .
ports:
- '80:8080'
environment:
- 'SITE_OWNER=tom@moulard.org'
- 'APP_KEY=${APP_KEY}'
- 'REDIS_HOST=2fauth-redis'
- 'DB_CONNECTION=postgres'
- 'DB_HOST=2fauth-postgres'
- 'DB_PORT=5432'
- 'DB_USER=postgres'
- 'DB_NAME=postgres'
- 'DB_PASSWORD=2fauth-postgres-pass'
volumes:
- './2fauth/db/:/2fauth/database/'
networks:
- '2fauth-internal'

2fauth-redis:
image: redis:6.0-alpine
restart: always
networks:
- '2fauth-internal'
healthcheck:
test: ["CMD", "redis-cli", "ping"]
volumes:
- './2fauth/redis:/data'

2fauth-postgres:
image: postgres:9.6-alpine
restart: always
user: '1000:1000'
shm_size: 256mb
networks:
- '2fauth-internal'
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
volumes:
- ./2fauth/postgres:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=2fauth-postgres-pass


8 changes: 8 additions & 0 deletions startup.sh
@@ -0,0 +1,8 @@
#!/bin/bash

set -e # exit if fails

php artisan passport:install
php artisan migrate:refresh

php -S localhost:80

0 comments on commit 35e23a6

Please sign in to comment.