Skip to content

Commit 73e977a

Browse files
authored
Merge pull request #865 from Yacht-sh/develop
Develop
2 parents 402e484 + 9527930 commit 73e977a

4 files changed

Lines changed: 37 additions & 41 deletions

File tree

Dockerfile

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,9 @@ RUN npm ci --legacy-peer-deps --no-audit --no-fund
1010
COPY ./frontend/ ./
1111
RUN npm run build
1212

13-
# Runtime image
14-
FROM python:3.11-slim AS deploy-stage
15-
16-
ARG DOCKER_COMPOSE_VERSION=v2.40.3
17-
18-
ENV PYTHONIOENCODING=UTF-8
19-
ENV THEME=Default
20-
ENV PYTHONPATH=/api
13+
# Build Python wheels in an isolated stage so compiler toolchains do not land in runtime.
14+
FROM python:3.11-slim AS python-wheel-builder
2115

22-
WORKDIR /api
2316
COPY ./backend/requirements.txt ./
2417

2518
RUN apt-get update && \
@@ -34,42 +27,41 @@ RUN apt-get update && \
3427
zlib1g-dev \
3528
libyaml-dev \
3629
python3-dev \
37-
nginx \
38-
curl \
3930
ca-certificates \
40-
bash && \
31+
&& \
4132
rm -rf /var/lib/apt/lists/*
4233

43-
RUN set -eux; \
44-
arch="$(uname -m)"; \
45-
case "${arch}" in \
46-
x86_64) compose_arch="x86_64" ;; \
47-
aarch64) compose_arch="aarch64" ;; \
48-
armv7l) compose_arch="armv7" ;; \
49-
armv6l) compose_arch="armv6" ;; \
50-
ppc64le) compose_arch="ppc64le" ;; \
51-
s390x) compose_arch="s390x" ;; \
52-
riscv64) compose_arch="riscv64" ;; \
53-
*) echo "Unsupported architecture: ${arch}" && exit 1 ;; \
54-
esac; \
55-
curl -fL "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-linux-${compose_arch}" -o /usr/local/bin/docker-compose; \
56-
chmod +x /usr/local/bin/docker-compose
57-
5834
RUN pip3 install --upgrade pip setuptools wheel && \
59-
pip3 install --no-cache-dir -r requirements.txt && \
60-
apt-get purge -y --auto-remove \
61-
build-essential \
62-
pkg-config \
63-
libffi-dev \
64-
libssl-dev \
65-
libpq-dev \
66-
default-libmysqlclient-dev \
67-
libjpeg-dev \
68-
zlib1g-dev \
69-
libyaml-dev \
70-
python3-dev && \
35+
pip3 wheel --wheel-dir /wheels -r requirements.txt setuptools
36+
37+
# Runtime image
38+
FROM python:3.11-slim AS deploy-stage
39+
40+
ENV PYTHONIOENCODING=UTF-8
41+
ENV THEME=Default
42+
ENV PYTHONPATH=/api
43+
44+
WORKDIR /api
45+
COPY ./backend/requirements.txt ./
46+
47+
RUN apt-get update && \
48+
apt-get install -y --no-install-recommends \
49+
nginx \
50+
docker-compose \
51+
ca-certificates \
52+
bash \
53+
libpq5 \
54+
libmariadb3 \
55+
libjpeg62-turbo \
56+
&& \
7157
rm -rf /var/lib/apt/lists/*
7258

59+
COPY --from=python-wheel-builder /wheels /wheels
60+
61+
RUN pip3 install --no-cache-dir --no-index --find-links=/wheels setuptools && \
62+
pip3 install --no-cache-dir --no-index --find-links=/wheels -r requirements.txt && \
63+
rm -rf /wheels
64+
7365
RUN groupadd -r abc && useradd -r -g abc abc
7466

7567
COPY ./backend/ /api/

frontend/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<title>Yacht</title>
88
<link rel="manifest" crossorigin="use-credentials" href="<%= BASE_URL %>manifest.json" />
99
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
10-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">
10+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@7.4.47/css/materialdesignicons.min.css">
1111
<link rel="apple-touch-icon" sizes="57x57" href="/img/icons/apple-touch-icon-57x57.png">
1212
<link rel="apple-touch-icon" sizes="60x60" href="/img/icons/apple-touch-icon-60x60.png">
1313
<link rel="apple-touch-icon" sizes="72x72" href="/img/icons/apple-touch-icon-72x72.png">

frontend/src/main.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ Vue.use(VueChatScroll);
1818

1919
Vue.config.productionTip = false;
2020

21+
// Configure axios to send cookies with all requests
22+
axios.defaults.withCredentials = true;
23+
axios.defaults.xsrfCookieName = "csrf_access_token";
24+
axios.defaults.xsrfHeaderName = "X-CSRF-TOKEN";
25+
2126
// Handle Token Refresh on 401
2227
function createAxiosResponseInterceptor() {
2328
const interceptor = axios.interceptors.response.use(

frontend/src/plugins/vuetify.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Vue from "vue";
22
import Vuetify from "vuetify/lib";
33
import { themeTheme } from "../config.js";
4-
import "@mdi/font/css/materialdesignicons.css";
54

65
Vue.use(Vuetify);
76

0 commit comments

Comments
 (0)