-
-
Notifications
You must be signed in to change notification settings - Fork 7
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 #55 from PeARSearch/add-dockerfile
Add dockerfile
- Loading branch information
Showing
7 changed files
with
94 additions
and
3 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,5 @@ | ||
.git/ | ||
.github/ | ||
.idea/ | ||
|
||
.gitignore |
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 Image CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: deployment/Dockerfile | ||
push: true | ||
tags: pearsproject/pears-federated:latest | ||
|
||
- name: Image digest | ||
run: echo ${{ steps.build.outputs.digest }} |
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,20 @@ | ||
.DEFAULT_GOAL: help | ||
SHELL := /bin/bash | ||
|
||
PROJECTNAME := "pears-federated" | ||
|
||
.PHONY: help | ||
all: help | ||
help: Makefile | ||
@echo | ||
@echo " Choose a command to run in "$(PROJECTNAME)":" | ||
@echo | ||
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /' | ||
@echo note: call scripts from /scripts | ||
|
||
check-%: # detection of required software. | ||
@which ${*} > /dev/null || (echo '*** Please install `${*}` ***' && exit 1) | ||
|
||
## build: Build the container image | ||
build: check-docker | ||
@docker buildx build --no-cache --pull -f deployment/Dockerfile -t ${PROJECTNAME}:local-build . |
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
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,26 @@ | ||
FROM python:3.9-slim | ||
|
||
WORKDIR /app | ||
|
||
COPY requirements.txt /tmp/ | ||
RUN pip install --requirement /tmp/requirements.txt | ||
|
||
# Additionally, install Gunicorn | ||
RUN pip install gunicorn | ||
|
||
# Make port 8000 available to the world outside this container | ||
EXPOSE 8000 | ||
|
||
ENV SQLALCHEMY_DATABASE_URI="sqlite:////var/lib/pears/data/app.db" | ||
ENV LOGO_PATH="/var/lib/pears/data" | ||
ENV PODS_DIR="/var/lib/pears/data/pods" | ||
ENV SUGGESTIONS_DIR="/var/lib/pears/data/userdata" | ||
|
||
RUN mkdir -p /var/lib/pears/data/pod /var/lib/pears/data/userdata | ||
|
||
COPY . /app | ||
|
||
RUN chmod +x /app/deployment/entrypoint.sh | ||
|
||
# Set the entrypoint script to be executed | ||
ENTRYPOINT ["/app/deployment/entrypoint.sh"] |
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,6 @@ | ||
#!/bin/bash | ||
# entrypoint.sh | ||
|
||
flask db migrate | ||
|
||
gunicorn -b 0.0.0.0:8000 -w 3 -t 120 app:app |