CAPIF GIT is a management system designed for the administration of the music industry.
Verify Docker version
docker --version
Create an empty folder somewhere your computer directory.
Inside the new folder, create a docker-compose.yml file and copy the following code:
services:
app:
build:
context: .
dockerfile: Dockerfile
image: javiertrombetta/capif-back:latest
container_name: capif-back
entrypoint: /usr/src/app/entrypoint.sh
restart: always
ports:
- '${PORT}:${PORT}'
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
environment:
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
DB_NAME: ${DB_NAME}
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}
NODE_ENV: production
JWT_SECRET: ${JWT_SECRET}
GLOBAL_PREFIX: ${GLOBAL_PREFIX}
PORT: ${PORT}
RESET_TOKEN_EXPIRATION: ${RESET_TOKEN_EXPIRATION}
MAX_LOGIN_ATTEMPTS: ${MAX_LOGIN_ATTEMPTS}
ALLOWED_FILE_TYPES: ${ALLOWED_FILE_TYPES}
REDIS_HOST: ${REDIS_HOST}
REDIS_PORT: ${REDIS_PORT}
TZ: ${TZ}
FRONTEND_URL: ${FRONTEND_URL}
SMTP_SERVICE: ${SMTP_SERVICE}
SMTP_FROM: ${SMTP_FROM}
SMTP_USER: ${SMTP_USER}
SMTP_PASS: ${SMTP_PASS}
networks:
- capif-net
postgres:
image: postgres:15.8-alpine3.20
container_name: postgres
restart: always
ports:
- '5432:5432'
environment:
TZ: ${TZ}
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- postgresdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER}"]
interval: 10s
retries: 5
start_period: 30s
timeout: 10s
networks:
- capif-net
redis:
image: redis:alpine3.20
container_name: redis
restart: always
ports:
- '6379:6379'
environment:
TZ: ${TZ}
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- capif-net
volumes:
postgresdata:
networks:
capif-net:
driver: bridge
Create a new file /.env with the following enviroment variables:
| Enviroment Variable name | Example | Description |
|---|---|---|
| GLOBAL_PREFIX | api/v1 | The prefix for all routes in the API |
| PORT | 3000 | The port number on which the server will run |
| NODE_ENV | production | Specifies the environment in which an application is running. Use production in order to work. |
| TZ | America/Argentina/Buenos_Aires | Check your time zone from this list and write the correct one. |
| Enviroment Variable name | Example | Description |
|---|---|---|
| CORS_ORIGIN | https://domain.com | The origin that is allowed to access the server, for CORS (Cross-Origin Resource Sharing) |
| CORS_METHODS | GET,POST,PUT,DELETE | Specifies the HTTP methods that are allowed when accessing the resource in a cross-origin manner. Use the methods GET, POST, PUT, and DELETE as described for full CRUD operations of the RestAPI. |
| Enviroment Variable name | Example | Description |
|---|---|---|
| POSTGRES_USER | example_user | The username for PostgreSQL authentication |
| POSTGRES_PASSWORD | example_password | The password for PostgreSQL authentication |
| POSTGRES_DB | example_db | The database name to connect to in PostgreSQL |
| Enviroment Variable name | Example | Description |
|---|---|---|
| JWT_SECRET | EXAMPLE_JASON_WEB_TOKEN_FOR_ENCYPT | The secret key for encoding and decoding JSON Web Tokens |
| Enviroment Variable name | Example | Description |
|---|---|---|
| SMTP_FROM= | write_app_name <[email protected]> | The email address that will appear as the sender |
| SMTP_SERVICES | write_mail_service | The email service provider (e.g., Gmail, Outlook) |
| SMTP_HOST | write_mail_host | The SMTP host for the email service |
| SMTP_PORT | write_mail_port | The port number for the SMTP service |
| SMTP_USER | write_mail_account | The username/email for the SMTP service |
| SMTP_PASSWORD | write_mail_password_or_token | The password or token for the SMTP service authentication |
Run the following command into a console terminal:
$ docker compose up -d
Run the following command into a console terminal just to delete everything:
$ docker compose down -v && docker rmi javiertrombetta/capif-back:latest
Content type
Image
Digest
sha256:ebbf4d737…
Size
98.6 MB
Last updated
over 1 year ago
docker pull javiertrombetta/capif-back