ci: add docker-build
This commit is contained in:
@@ -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
|
||||||
+2
-2
@@ -3,7 +3,7 @@ FROM python:3.11-slim
|
|||||||
RUN apt-get update && apt-get install -y curl && \
|
RUN apt-get update && apt-get install -y curl && \
|
||||||
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
|
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
|
||||||
apt-get install -y nodejs && \
|
apt-get install -y nodejs && \
|
||||||
npm install -g sass && \
|
NODE_OPTIONS=--dns-result-order=ipv4first npm install -g sass && \
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@@ -11,4 +11,4 @@ WORKDIR /app
|
|||||||
COPY . .
|
COPY . .
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
CMD flask run
|
CMD flask run --host 0.0.0.0
|
||||||
|
|||||||
Reference in New Issue
Block a user