Skip to content

Commit

Permalink
publish Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
1ma committed Jun 15, 2024
1 parent 72f824a commit 9678af7
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 4 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: CI
name: Continuous Integration

on: push

jobs:
run:
name: Continuous Integration
run-tests:
name: Run linter and tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -20,3 +20,22 @@ jobs:
- run: composer test
- if: always()
run: docker compose down -v
build-image:
name: Build Docker image
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs:
- run-tests
steps:
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: 1maa
password: ${{ secrets.DOCKER_HUB_PASS }}
- uses: docker/build-push-action@v5
with:
cache-from: type=registry,ref=1maa/bbo-faucet:latest
cache-to: type=inline
context: .
push: true
tags: 1maa/bbo-faucet:latest
45 changes: 45 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM 1maa/php-dev:8.3 AS builder

WORKDIR /tmp/faucet

COPY bin bin
COPY src src
COPY views views
COPY web web
COPY composer.json .
COPY composer.lock .

RUN composer install --no-dev --classmap-authoritative \
&& chown -R nobody:nobody /tmp/faucet


FROM 1maa/php:8.3 AS final

ENV FAUCET_DEBUG=0
ENV FAUCET_REDIS_ENDPOINT=redis:6379
ENV FAUCET_REDIS_PREFIX="faucet:"
ENV FAUCET_BITCOIN_RPC_ENDPOINT="http://knots:18443"
ENV FAUCET_BITCOIN_RPC_USER=knots
ENV FAUCET_BITCOIN_RPC_PASS=knots
ENV FAUCET_NAME="Your Signet Faucet"
ENV FAUCET_MIN_ONE_TIME_BTC=0.001
ENV FAUCET_MAX_ONE_TIME_BTC=5.0
ENV FAUCET_USER_SESSION_TTL=3600
ENV FAUCET_GLOBAL_SESSION_TTL=3600
ENV FAUCET_USE_CAPTCHA=0
ENV FAUCET_USE_BATCHING=0
ENV FAUCET_FEE_RATE=0
ENV FAUCET_USER_SESSION_MAX_BTC=20.0
ENV FAUCET_GLOBAL_SESSION_MAX_BTC=150.0

ENV PHP_CLI_SERVER_WORKERS=8

COPY --from=builder /tmp/faucet /var/www/faucet

WORKDIR /var/www/faucet

USER nobody

EXPOSE 8080

CMD ["php", "-d", "variables_order=EGPCS", "-S", "0.0.0.0:8080", "-t", "web"]
2 changes: 1 addition & 1 deletion src/DI/Faucet.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class Faucet implements ServiceProvider
public function provide(Container $c): void
{
$c->set(Settings::class, static function (): Settings {
return new Settings($_SERVER);
return new Settings(array_merge($_SERVER, $_ENV));
});

$c->set(Twig::class, static function (ContainerInterface $c): Twig {
Expand Down

0 comments on commit 9678af7

Please sign in to comment.