-
-
Notifications
You must be signed in to change notification settings - Fork 173
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (50 loc) · 2.51 KB
/
Copy pathDockerfile
File metadata and controls
64 lines (50 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Builds the selkies Python wheel, with the HTML5 web client built from source
# inside this same repo (addons/) and bundled into the wheel. No external or
# pre-published images are consumed.
# 1) Build the web client (core + dashboard + keyboard-layout DB + touch gamepad)
FROM docker.io/library/node:26-alpine AS web-build
ARG SELKIES_MODE=webrtc
ARG SELKIES_UPLOAD_DIR=/home/ubuntu/Desktop
WORKDIR /build
COPY addons/selkies-web-core ./selkies-web-core
COPY addons/selkies-dashboard ./selkies-dashboard
COPY addons/universal-touch-gamepad ./universal-touch-gamepad
# Web PWA icon/favicon are vendored in this repository, not downloaded
COPY docs/assets /repo-assets
RUN set -eux; \
cd selkies-web-core; \
npm install --no-audit --no-fund; \
npm run build; \
cd ../selkies-dashboard; \
cp ../selkies-web-core/dist/selkies-core.js src/; \
npm install --no-audit --no-fund; \
SELKIES_INJECT=1 SELKIES_MODE="${SELKIES_MODE}" SELKIES_UPLOAD_DIR="${SELKIES_UPLOAD_DIR}" npm run build; \
mkdir -p dist/src; \
cp ../selkies-web-core/dist/selkies-core.js dist/src/; \
cp ../universal-touch-gamepad/universalTouchGamepad.js dist/src/; \
cp -r ../selkies-web-core/dist/jsdb dist/; \
mkdir -p /webout; \
cp -ar dist/. /webout/; \
printf '%s' '{"name":"Selkies","short_name":"Selkies","manifest_version":2,"version":"1.0.0","display":"fullscreen","background_color":"#000000","theme_color":"#000000","icons":[{"src":"icon.png","type":"image/png","sizes":"512x512"}],"start_url":"/"}' > /webout/manifest.json; \
cp /repo-assets/logo/icon-512x512.png /webout/icon.png; \
cp /repo-assets/logo/favicon.ico /webout/favicon.ico
# 2) Build the Python wheel with the web client bundled
FROM docker.io/library/python:3-slim AS py-build
LABEL maintainer="https://github.com/danisla,https://github.com/ehfd"
ARG PYPI_PACKAGE=selkies
ARG PACKAGE_VERSION=0.0.0.dev0
RUN python3 -m pip install --no-cache-dir --upgrade build
WORKDIR /opt/pypi
COPY src ./src
COPY README.md pyproject.toml ./
# Include the production built web files in the wheel package
COPY --from=web-build /webout ./src/selkies/selkies_web
# Patch the package name and version
RUN sed -i \
-e "s|^name =.*|name = \"${PYPI_PACKAGE}\"|g" \
-e "s|^version =.*|version = \"${PACKAGE_VERSION}\"|g" \
pyproject.toml
RUN python3 -m build