-
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.
- Loading branch information
1 parent
38cd3fd
commit e7ab1e4
Showing
4 changed files
with
78 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
FLASK_APP=app.app.py | ||
FLASK_APP=app.py | ||
FLASK_ENV=development | ||
FLASK_RUN_PORT=5000 |
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,31 @@ | ||
name: PullPreview | ||
on: | ||
pull_request: | ||
types: [labeled, unlabeled, synchronize, closed, reopened] | ||
|
||
jobs: | ||
deploy: | ||
permissions: | ||
contents: read # to fetch code (actions/checkout) | ||
deployments: write # to delete deployments | ||
pull-requests: write # to remove labels | ||
statuses: write # to create commit status | ||
id-token: write # This is required for AWS credentials | ||
name: deploy | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
environment: ${{ inputs.environment || 'dev' }} | ||
steps: | ||
- name: configure aws credentials | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT }}:role/GithubCopilotDeploy | ||
role-session-name: FUNDING_SERVICE_DESIGN_FUND_APPLICATION_BUILDER_PULLPREVIEW | ||
aws-region: eu-west-2 | ||
- uses: actions/checkout@v2 | ||
- uses: pullpreview/[email protected] | ||
with: | ||
compose_files: docker-compose.pullpreview.yml | ||
ports: 8080/tcp | ||
default_port: 8080 | ||
admins: gidsg |
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 @@ | ||
# Start with a Python base image | ||
FROM python:3.10-slim | ||
# Install PostgreSQL | ||
RUN apt-get update && \ | ||
apt-get install -y postgresql postgresql-contrib | ||
# Set environment variables for PostgreSQL | ||
ENV POSTGRES_USER=postgres \ | ||
POSTGRES_PASSWORD=password \ | ||
POSTGRES_DB=fund_builder | ||
# Expose the default PostgreSQL port | ||
EXPOSE 5432 | ||
# Create a directory for the app | ||
WORKDIR /app | ||
# Copy application files | ||
COPY . . | ||
# Install Python dependencies into a virtual environment | ||
RUN pip install --upgrade pip && pip install -r requirements-dev.txt | ||
# Configure PostgreSQL (set up user, database, etc.) | ||
RUN service postgresql start && \ | ||
su - postgres -c "psql -c \"ALTER USER ${POSTGRES_USER} WITH PASSWORD '${POSTGRES_PASSWORD}';\"" && \ | ||
su - postgres -c "psql -c \"CREATE DATABASE ${POSTGRES_DB};\"" && \ | ||
su - postgres -c "psql -c \"GRANT ALL PRIVILEGES ON DATABASE ${POSTGRES_DB} TO ${POSTGRES_USER};\"" | ||
# Expose Flask app port | ||
EXPOSE 8080 | ||
# Start PostgreSQL and the Flask app using the virtual environment | ||
CMD service postgresql start && /bin/bash -c "python -m flask db upgrade && python -m debugpy --listen 0.0.0.0:5601 -m flask run --no-debugger --host 0.0.0.0 --port 8080" |
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 @@ | ||
|
||
services: | ||
fab: | ||
hostname: fab | ||
build: | ||
context: ../funding-service-design-fund-application-builder | ||
dockerfile: Dockerfile.pullpreview | ||
volumes: [ | ||
'../funding-service-design-fund-application-builder:/app', | ||
'../funding-service-design-fund-application-builder/postgresql:/var/lib/postgresql/data', | ||
] | ||
ports: | ||
- 5432:5432 | ||
- 8080:8080 | ||
environment: | ||
- FORM_RUNNER_INTERNAL_HOST=http://localhost:3009 | ||
- FORM_RUNNER_EXTERNAL_HOST=http://localhost:3009 | ||
- DATABASE_URL=postgresql://postgres:password@localhost:5432/fund_builder | ||
- FLASK_DEBUG=0 | ||
- FLASK_ENV=development |