Authority
  • Introduction
  • In Action
  • Performance at Scale
  • Roadmap / Features
  • Getting Started
    • Introduction
    • Installation
    • Configuration Overview
  • Authentication
    • Authentication Guide
    • API Documentation
    • Customizing Authentication
  • Security & Error Handling
    • Security Considerations
    • Error Handling & Troubleshooting
  • Providers
    • Client Providers
    • Owner Providers
  • API Endpoints
    • API Endpoints
  • DEVELOPMENT
    • Requirements
    • Database
    • User Interface
    • Specs
    • Deployment
      • Environment Variables
  • Reference
    • OAuth Terms
    • OAuth 2 Grant Flows
      • Device Flow
      • Authorization Flow
      • Client Credentials Flow
      • Refreshing Access Tokens
      • Access Token Response
      • Json Web Tokens
      • Legacy: Implicit grant
      • Legacy: Password
    • Open ID Connect
      • Configuration
      • Registering Clients
      • User Info
Powered by GitBook
On this page
  • Dockerfile
  • Docker-Compose

Was this helpful?

Export as PDF
  1. DEVELOPMENT

Deployment

PreviousSpecsNextEnvironment Variables

Last updated 7 months ago

Was this helpful?

This tutorial walks you through a quick setup of Authority, a PostgreSQL instance, and a simple User Login & Consent App based on Docker Compose. You need to have the latest and version installed.

Dockerfile

Authority project contains a simple Dockerfile that compiles and builds a simple docker image with little to no dependencies.

FROM crystallang/crystal:latest-alpine as source
WORKDIR /opt/app
COPY . /opt/app
RUN shards install
RUN crystal build --release --static ./src/server.cr -o ./server
CMD ["crystal", "spec"]

FROM alpine:latest  
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=source /opt/app/server .
COPY --from=source /opt/app/public ./public
CMD ["./server"]

Docker-Compose

To start using Authority run the following command

docker-compose up server

To change the Authority server configuration change the local.env file

version: "3.7"
services:
  db:
    image: postgres
    restart: always
    environment:
      POSTGRES_DB: authority_db
      POSTGRES_USER: auth_user
      POSTGRES_PASSWORD: auth_pass
    ports:
      - 5432:5432

  server:
    build:
      context: .
      dockerfile: Dockerfile
    command: ./server
    container_name: authority-server
    working_dir: /root/
    env_file:
      - local.env
    ports:
      - "4000:4000"
    depends_on:
      - db

Docker
Docker Compose