-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add docker action file Modify docker-compose.prod.yml to use environment variables instead of .env files
- Loading branch information
1 parent
9bc9148
commit f5b64a7
Showing
2 changed files
with
56 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build-containers: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build and run the container | ||
env: | ||
FASTAPI_SECRET_KEY: ${{secrets.FASTAPI_SECRET_KEY}} | ||
FASTAPI_HASH_ALGORITHM: ${{secrets.FASTAPI_HASH_ALGORITHM}} | ||
ACCESS_TOKEN_EXPIRE_MINUTES: ${{secrets.ACCESS_TOKEN_EXPIRE_MINUTES}} | ||
USER_DB_URL: ${{secrets.USER_DB_URL}} | ||
FILE_DB_URL: ${{secrets.FILE_DB_URL}} | ||
POSTGRES_USER: ${{secrets.POSTGRES_USER}} | ||
POSTGRES_PASSWORD: ${{secrets.POSTGRES_PASSWORD}} | ||
POSTGRES_DB: ${{secrets.POSTGRES_DB}} | ||
NEXT_PUBLIC_ENVIRONMENT: ${{secrets.NEXT_PUBLIC_ENVIRONMENT}} | ||
NEXT_PUBLIC_API_URL: ${{secrets.NEXT_PUBLIC_API_URL}} | ||
run: | | ||
docker-compose -f docker-compose.prod.yml build | ||
sleep 10 | ||
docker-compose -f docker-compose.prod.yml up --abort-on-container-exit | ||
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 |
---|---|---|
@@ -1,56 +1,32 @@ | ||
services: | ||
frontend: | ||
build: | ||
context: ./frontend-app/ | ||
dockerfile: Dockerfile | ||
networks: | ||
- my_network | ||
ports: | ||
- "3000:3000" | ||
depends_on: | ||
- backend | ||
env_file: | ||
- frontend.env | ||
|
||
backend: | ||
build: | ||
context: ./backend-app/ | ||
dockerfile: Dockerfile | ||
networks: | ||
- my_network | ||
image: your_backend_image | ||
environment: | ||
- FASTAPI_SECRET_KEY | ||
- FASTAPI_HASH_ALGORITHM | ||
- ACCESS_TOKEN_EXPIRE_MINUTES | ||
- USER_DB_URL | ||
- FILE_DB_URL | ||
ports: | ||
- "8000:8000" | ||
depends_on: | ||
- userdb | ||
- filedb | ||
env_file: | ||
- backend.env | ||
|
||
userdb: | ||
image: postgres:13 | ||
database: | ||
image: postgres:latest | ||
environment: | ||
- POSTGRES_USER | ||
- POSTGRES_PASSWORD | ||
- POSTGRES_DB | ||
volumes: | ||
- userdb_data:/var/lib/postgresql/data | ||
ports: | ||
- "5433:5432" | ||
networks: | ||
- my_network | ||
env_file: | ||
- database.env | ||
filedb: | ||
image: postgres:13 | ||
volumes: | ||
- filedb_data:/var/lib/postgresql/data | ||
- postgres_data:/var/lib/postgresql/data | ||
|
||
frontend: | ||
image: your_frontend_image | ||
environment: | ||
- NEXT_PUBLIC_ENVIRONMENT | ||
- NEXT_PUBLIC_API_URL | ||
ports: | ||
- "5432:5432" | ||
networks: | ||
- my_network | ||
env_file: | ||
- database.env | ||
- "3000:3000" | ||
|
||
volumes: | ||
userdb_data: | ||
filedb_data: | ||
postgres_data: | ||
|
||
networks: | ||
my_network: | ||
driver: bridge |