Compare commits
	
		
			3 Commits
		
	
	
		
			yc-templat
			...
			flask_debu
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 7332be5567 | |||
| 72c04d8495 | |||
| 5bb76173dd | 
							
								
								
									
										13
									
								
								.drone.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								.drone.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | ||||
| --- | ||||
| kind: pipeline | ||||
| name: publish docker image | ||||
| steps: | ||||
|   - name: build and publish | ||||
|     image: plugins/docker | ||||
|     settings: | ||||
|       username: | ||||
|         from_secret: docker_reg_username_3wc | ||||
|       password: | ||||
|         from_secret: docker_reg_passwd_3wc | ||||
|       repo: 3wordchant/capsul-flask | ||||
|       tags: ${DRONE_COMMIT_BRANCH} | ||||
							
								
								
									
										48
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,48 @@ | ||||
| FROM python:3.8-alpine as build | ||||
|  | ||||
| RUN apk add --no-cache \ | ||||
|     build-base \ | ||||
|     gcc \ | ||||
|     gettext \ | ||||
|     git \ | ||||
|     jpeg-dev \ | ||||
|     libffi-dev \ | ||||
|     libjpeg \ | ||||
|     musl-dev \ | ||||
|     postgresql-dev \ | ||||
|     python3-dev \ | ||||
|     zlib-dev | ||||
|  | ||||
| RUN mkdir -p /app/{code,venv} | ||||
| WORKDIR /app/code | ||||
| COPY Pipfile Pipfile.lock /app/code/ | ||||
|  | ||||
| RUN python3 -m venv /app/venv | ||||
| RUN pip install pipenv setuptools | ||||
| ENV PATH="/app/venv/bin:$PATH" VIRTUAL_ENV="/app/venv" | ||||
| RUN pip install wheel cppy | ||||
| # Install dependencies into the virtual environment with Pipenv | ||||
| RUN pipenv install --deploy --verbose | ||||
|  | ||||
| FROM python:3.8-alpine | ||||
|  | ||||
| RUN apk add --no-cache \ | ||||
|     cloud-utils \ | ||||
|     libjpeg \ | ||||
|     libpq \ | ||||
|     libstdc++ \ | ||||
|     libvirt-client \ | ||||
|     openssh-client \ | ||||
|     virt-install | ||||
|  | ||||
| COPY . /app/code/ | ||||
| WORKDIR /app/code | ||||
|  | ||||
| COPY --from=build /app/venv /app/venv | ||||
| ENV PATH="/app/venv/bin:$PATH" VIRTUAL_ENV="/app/venv" | ||||
|  | ||||
| CMD ["gunicorn", "--bind", "0.0.0.0:5000", "-k", "gevent", "--worker-connections", "1000", "app:app"] | ||||
|  | ||||
| VOLUME /app/code | ||||
|  | ||||
| EXPOSE 5000 | ||||
| @ -27,11 +27,29 @@ class StdoutMockFlaskMail: | ||||
|     def send(self, message: Message): | ||||
|       current_app.logger.info(f"Email would have been sent if configured:\n\nto: {','.join(message.recipients)}\nsubject: {message.subject}\nbody:\n\n{message.body}\n\n") | ||||
|  | ||||
|  | ||||
| load_dotenv(find_dotenv()) | ||||
|  | ||||
| for var_name in [ | ||||
|   "SPOKE_HOST_TOKEN", "HUB_TOKEN", "STRIPE_SECRET_KEY", | ||||
|   "BTCPAY_PRIVATE_KEY", "MAIL_PASSWORD" | ||||
| ]: | ||||
|   var = os.environ.get(f"{var_name}_FILE") | ||||
|   if not var: | ||||
|     continue | ||||
|  | ||||
|   if not os.path.isfile(var): | ||||
|     continue | ||||
|  | ||||
|   with open(var) as secret_file: | ||||
|     os.environ[var_name] = secret_file.read().rstrip('\n') | ||||
|   del os.environ[f"{var_name}_FILE"] | ||||
|  | ||||
| app = Flask(__name__) | ||||
|  | ||||
| app.config.from_mapping( | ||||
|   FLASK_DEBUG=os.environ.get("FLASK_DEBUG", default="0"), | ||||
|  | ||||
|   BASE_URL=os.environ.get("BASE_URL", default="http://localhost:5000"), | ||||
|   SECRET_KEY=os.environ.get("SECRET_KEY", default="dev"), | ||||
|   HUB_MODE_ENABLED=os.environ.get("HUB_MODE_ENABLED", default="True").lower() in ['true', '1', 't', 'y', 'yes'], | ||||
|  | ||||
							
								
								
									
										36
									
								
								docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,36 @@ | ||||
| --- | ||||
| version: "3.8" | ||||
|  | ||||
| services: | ||||
|   app: | ||||
|     image: 3wordchant/capsul-flask:latest | ||||
|     build: . | ||||
|     volumes: | ||||
|       - "./:/app/code" | ||||
|       - "../tank:/tank" | ||||
|       # - "/var/run/libvirt/libvirt-sock:/var/run/libvirt/libvirt-sock" | ||||
|     depends_on: | ||||
|       - db | ||||
|     ports: | ||||
|       - "5000:5000" | ||||
|     environment: | ||||
|       - "POSTGRES_CONNECTION_PARAMETERS=host=db port=5432 user=capsul password=capsul dbname=capsul" | ||||
|       - SPOKE_MODEL=shell-scripts | ||||
|         #- FLASK_DEBUG=1 | ||||
|       - BASE_URL=http://localhost:5000 | ||||
|       - ADMIN_PANEL_ALLOW_EMAIL_ADDRESSES=3wc.capsul@doesthisthing.work | ||||
|       - VIRSH_DEFAULT_CONNECT_URI=qemu:///system | ||||
|     # The image uses gunicorn by default, let's override it with Flask's | ||||
|     # built-in development server | ||||
|     command: ["flask", "run", "-h", "0.0.0.0", "-p", "5000"] | ||||
|   db: | ||||
|     image: "postgres:9.6.5-alpine" | ||||
|     volumes: | ||||
|       - "postgres:/var/lib/postgresql/data" | ||||
|     environment: | ||||
|       POSTGRES_USER: capsul | ||||
|       POSTGRES_PASSWORD: capsul | ||||
|       POSTGRES_DB: capsul | ||||
|  | ||||
| volumes: | ||||
|   postgres: | ||||
		Reference in New Issue
	
	Block a user
	