-
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.
Merge pull request #9 from bescka/add_docker_action
Add Docker Action
- Loading branch information
Showing
4 changed files
with
90 additions
and
10 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,41 @@ | ||
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.DOCKER_USER_DB_URL}} | ||
FILE_DB_URL: ${{secrets.DOCKER_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 up -d | ||
sleep 30 | ||
- name: Check container status | ||
run: docker ps -a | ||
|
||
- name: Get container logs | ||
run: docker-compose -f docker-compose.prod.yml logs | ||
|
||
- name: Clean up | ||
run: docker-compose -f docker-compose.prod.yml down |
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,17 @@ | ||
FROM python:3.12-slim | ||
|
||
# Update and install dependencies | ||
RUN apt-get update \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR / | ||
|
||
COPY requirements.txt . | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
COPY /app/ /app/ | ||
|
||
|
||
EXPOSE 8000 | ||
|
||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"] |
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
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,13 @@ | ||
FROM node:slim | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json ./ | ||
|
||
RUN npm install | ||
|
||
COPY . . | ||
|
||
EXPOSE 3000 | ||
|
||
CMD ["npm", "run", "dev"] |