This commit is contained in:
@@ -11,6 +11,12 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 'Docker Tags'
|
||||||
|
id: tags
|
||||||
|
uses: cssnr/docker-tags-action@v2
|
||||||
|
with:
|
||||||
|
images: 'g.lair.moe/${{ vars.DOCKER_USERNAME }}/lair.moe'
|
||||||
|
|
||||||
- name: Login to Docker Registry
|
- name: Login to Docker Registry
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
@@ -27,5 +33,6 @@ jobs:
|
|||||||
context: .
|
context: .
|
||||||
push: ${{ github.event_name == 'push' }}
|
push: ${{ github.event_name == 'push' }}
|
||||||
tags: g.lair.moe/${{ vars.DOCKER_USERNAME }}/lair.moe:latest
|
tags: g.lair.moe/${{ vars.DOCKER_USERNAME }}/lair.moe:latest
|
||||||
|
labels: ${{ steps.tags.outputs.labels }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|||||||
+32
-11
@@ -1,25 +1,46 @@
|
|||||||
FROM node:18-alpine as sass
|
FROM node:18-alpine AS sass-builder
|
||||||
|
|
||||||
RUN NODE_OPTIONS=--dns-result-order=ipv4first npm install -g sass
|
RUN NODE_OPTIONS=--dns-result-order=ipv4first npm install -g sass@latest --omit=dev --no-fund --no-audit
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
COPY ./blueprints ./blueprints
|
COPY ./blueprints ./blueprints
|
||||||
|
|
||||||
RUN sass ./blueprints:./blueprints \
|
RUN sass ./blueprints:./blueprints \
|
||||||
--no-source-map \
|
--no-source-map \
|
||||||
--style=compressed
|
--style=compressed \
|
||||||
|
--quiet
|
||||||
|
|
||||||
FROM python:3.11-slim
|
FROM python:3.11-slim
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install --no-install-recommends -y \
|
||||||
|
libmagic1 \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN pip install --no-cache-dir --no-deps -r requirements.txt
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
COPY --from=sass /build/blueprints/ ./blueprints/
|
|
||||||
|
|
||||||
RUN apt update && apt upgrade
|
COPY --from=sass-builder /build/blueprints/ ./blueprints/
|
||||||
RUN apt install libmagic1 -y
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
|
||||||
|
|
||||||
ENV FLASK_ENV=production
|
RUN useradd -m -u 1001 appuser && \
|
||||||
ENV PYTHONUNBUFFERED=1
|
chown -R appuser:appuser /app
|
||||||
|
|
||||||
CMD ["gunicorn", "app:app", "-b", "0.0.0.0:80", "--workers", "4"]
|
USER appuser
|
||||||
|
|
||||||
|
ENV FLASK_ENV=production \
|
||||||
|
PYTHONUNBUFFERED=1 \
|
||||||
|
PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
PIP_NO_CACHE_DIR=1 \
|
||||||
|
PIP_DISABLE_PIP_VERSION_CHECK=1
|
||||||
|
|
||||||
|
CMD ["gunicorn", "app:app", \
|
||||||
|
"-b", "0.0.0.0:80", \
|
||||||
|
"--workers", "4", \
|
||||||
|
"--worker-class", "sync", \
|
||||||
|
"--worker-tmp-dir", "/dev/shm", \
|
||||||
|
"--access-logfile", "-", \
|
||||||
|
"--error-logfile", "-", \
|
||||||
|
"--log-level", "info"]
|
||||||
|
|||||||
Reference in New Issue
Block a user