Compare commits
2
Commits
c7972a7bed
...
3a5e991870
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a5e991870 | ||
|
|
5da241b62e |
No files matched your search
@@ -0,0 +1,33 @@
|
|||||||
|
name: Docker Build and Push
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Login to Docker Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: g.codrs.ru
|
||||||
|
username: ${{ vars.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: ${{ github.event_name == 'push' }}
|
||||||
|
tags: |
|
||||||
|
g.codrs.ru/${{ vars.DOCKER_USERNAME }}/codrs.ru:latest
|
||||||
|
g.codrs.ru/${{ vars.DOCKER_USERNAME }}/codrs.ru:${{ github.sha }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
+16
-7
@@ -1,14 +1,23 @@
|
|||||||
FROM python:3.11-slim
|
FROM node:18-alpine as sass
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y curl && \
|
RUN NODE_OPTIONS=--dns-result-order=ipv4first npm install -g sass
|
||||||
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
|
WORKDIR /build
|
||||||
apt-get install -y nodejs && \
|
COPY ./static/style ./style
|
||||||
npm install -g sass && \
|
RUN sass ./style:./style \
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
--no-source-map \
|
||||||
|
--style=compressed
|
||||||
|
|
||||||
|
|
||||||
|
FROM python:3.11-slim
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
COPY --from=sass /build/style/ ./static/style/
|
||||||
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
CMD flask run
|
ENV FLASK_ENV=production
|
||||||
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
|
CMD ["gunicorn", "app:app", "-b", "0.0.0.0:80", "--workers", "4"]
|
||||||
@@ -2,6 +2,8 @@ from os import system as console
|
|||||||
from flask import Flask, render_template
|
from flask import Flask, render_template
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
if app.debug:
|
||||||
console("sass static/style/main.scss static/style/main.css")
|
console("sass static/style/main.scss static/style/main.css")
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
Flask==3.1.1
|
Flask==3.1.1
|
||||||
|
gunicorn
|
||||||
Reference in new issue
Block a user