Compare commits
2 commits
1179fa0f80
...
1379a436b3
| Author | SHA1 | Date | |
|---|---|---|---|
| 1379a436b3 | |||
| 1f6aeadae0 |
3 changed files with 64 additions and 60 deletions
47
Dockerfile
47
Dockerfile
|
|
@ -1,6 +1,7 @@
|
||||||
ARG NODE_VERSION=24
|
ARG NODE_VERSION=24
|
||||||
ARG PYTHON_VERSION=3.14
|
ARG PYTHON_VERSION=3.14
|
||||||
|
|
||||||
|
|
||||||
############
|
############
|
||||||
# build ui #
|
# build ui #
|
||||||
############
|
############
|
||||||
|
|
@ -8,25 +9,25 @@ ARG PYTHON_VERSION=3.14
|
||||||
ARG NODE_VERSION
|
ARG NODE_VERSION
|
||||||
FROM node:${NODE_VERSION} AS build-ui
|
FROM node:${NODE_VERSION} AS build-ui
|
||||||
|
|
||||||
# env setup
|
# install ui dependencies
|
||||||
WORKDIR /usr/local/src/advent22_ui
|
WORKDIR /usr/local/src/advent22_ui
|
||||||
|
|
||||||
# install advent22_ui dependencies
|
|
||||||
RUN --mount=type=bind,source=ui/package.json,target=package.json \
|
RUN --mount=type=bind,source=ui/package.json,target=package.json \
|
||||||
--mount=type=bind,source=ui/yarn.lock,target=yarn.lock \
|
--mount=type=bind,source=ui/yarn.lock,target=yarn.lock \
|
||||||
|
--mount=type=bind,source=ui/.yarn/releases,target=.yarn/releases \
|
||||||
|
--mount=type=bind,source=ui/.yarnrc.yml,target=.yarnrc.yml \
|
||||||
|
--mount=type=cache,id=ui,target=/root/.yarn \
|
||||||
|
\
|
||||||
|
yarn install --immutable --check-cache;
|
||||||
|
|
||||||
|
# copy and build ui
|
||||||
|
COPY ui ./
|
||||||
|
RUN --mount=type=cache,id=ui,target=/root/.yarn \
|
||||||
set -ex; \
|
set -ex; \
|
||||||
\
|
|
||||||
corepack enable; \
|
|
||||||
yarn install --frozen-lockfile;
|
|
||||||
|
|
||||||
# copy and build advent22_ui
|
|
||||||
COPY ui ./
|
|
||||||
RUN set -ex; \
|
|
||||||
\
|
\
|
||||||
yarn dlx update-browserslist-db@latest; \
|
yarn dlx update-browserslist-db@latest; \
|
||||||
yarn build --dest /tmp/advent22_ui; \
|
yarn build --dest /opt/advent22/ui; \
|
||||||
# exclude webpack-bundle-analyzer output
|
# exclude webpack-bundle-analyzer output
|
||||||
rm -f /tmp/advent22_ui/report.html;
|
rm -f /opt/advent22/ui/report.html;
|
||||||
|
|
||||||
|
|
||||||
###############
|
###############
|
||||||
|
|
@ -35,18 +36,17 @@ RUN set -ex; \
|
||||||
|
|
||||||
ARG PYTHON_VERSION
|
ARG PYTHON_VERSION
|
||||||
FROM dhi.io/python:${PYTHON_VERSION}-dev AS install-app
|
FROM dhi.io/python:${PYTHON_VERSION}-dev AS install-app
|
||||||
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||||
|
|
||||||
# env setup
|
# env setup
|
||||||
WORKDIR /opt/advent22
|
WORKDIR /opt/advent22
|
||||||
ENV UV_WORKING_DIR="api/" \
|
ENV UV_COMPILE_BYTECODE=1 \
|
||||||
UV_COMPILE_BYTECODE=1 \
|
|
||||||
UV_NO_DEV=1 \
|
UV_NO_DEV=1 \
|
||||||
UV_LINK_MODE="copy"
|
UV_LINK_MODE="copy"
|
||||||
|
|
||||||
RUN --mount=from=ghcr.io/astral-sh/uv,source=/uv,target=/bin/uv \
|
RUN --mount=type=bind,source=api/uv.lock,target=api/uv.lock \
|
||||||
--mount=type=cache,target=/root/.cache/uv \
|
|
||||||
--mount=type=bind,source=api/uv.lock,target=api/uv.lock \
|
|
||||||
--mount=type=bind,source=api/pyproject.toml,target=api/pyproject.toml \
|
--mount=type=bind,source=api/pyproject.toml,target=api/pyproject.toml \
|
||||||
|
--mount=type=cache,id=api,target=/root/.cache/uv \
|
||||||
set -ex; \
|
set -ex; \
|
||||||
\
|
\
|
||||||
# prepare data directory
|
# prepare data directory
|
||||||
|
|
@ -54,25 +54,26 @@ RUN --mount=from=ghcr.io/astral-sh/uv,source=/uv,target=/bin/uv \
|
||||||
chown nobody:nobody data; \
|
chown nobody:nobody data; \
|
||||||
chmod u=rwx,g=rx,o=rx data; \
|
chmod u=rwx,g=rx,o=rx data; \
|
||||||
\
|
\
|
||||||
# install advent22_api deps
|
# install api deps
|
||||||
uv sync \
|
uv sync \
|
||||||
|
--project api/ \
|
||||||
--locked \
|
--locked \
|
||||||
--no-install-project \
|
--no-install-project \
|
||||||
--no-editable \
|
--no-editable \
|
||||||
;
|
;
|
||||||
|
|
||||||
# install advent22_api
|
# install api
|
||||||
COPY api api/
|
COPY api api/
|
||||||
RUN --mount=from=ghcr.io/astral-sh/uv,source=/uv,target=/bin/uv \
|
RUN --mount=type=cache,id=api,target=/root/.cache/uv \
|
||||||
--mount=type=cache,target=/root/.cache/uv \
|
|
||||||
\
|
\
|
||||||
uv sync \
|
uv sync \
|
||||||
|
--project api/ \
|
||||||
--locked \
|
--locked \
|
||||||
--no-editable \
|
--no-editable \
|
||||||
;
|
;
|
||||||
|
|
||||||
# add prepared advent22_ui
|
# add prepared ui
|
||||||
COPY --from=build-ui /tmp/advent22_ui ui/
|
COPY --from=build-ui /opt/advent22/ui ui/
|
||||||
|
|
||||||
|
|
||||||
####################
|
####################
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
"ghcr.io/devcontainers/features/git-lfs:1": {},
|
"ghcr.io/devcontainers/features/git-lfs:1": {},
|
||||||
"ghcr.io/devcontainers-extra/features/uv:1": {},
|
"ghcr.io/devcontainers-extra/features/uv:1": {},
|
||||||
"ghcr.io/devcontainers-extra/features/zsh-plugins:0": {
|
"ghcr.io/devcontainers-extra/features/zsh-plugins:0": {
|
||||||
"plugins": "uv"
|
"plugins": "git-flow uv"
|
||||||
},
|
},
|
||||||
"ghcr.io/devcontainers-extra/features/apt-get-packages:1": {
|
"ghcr.io/devcontainers-extra/features/apt-get-packages:1": {
|
||||||
"packages": "git-flow"
|
"packages": "git-flow"
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@
|
||||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||||
"features": {
|
"features": {
|
||||||
"ghcr.io/devcontainers/features/git-lfs:1": {},
|
"ghcr.io/devcontainers/features/git-lfs:1": {},
|
||||||
|
"ghcr.io/devcontainers-extra/features/zsh-plugins:0": {
|
||||||
|
"plugins": "git-flow npm nvm yarn"
|
||||||
|
},
|
||||||
"ghcr.io/devcontainers-extra/features/apt-get-packages:1": {
|
"ghcr.io/devcontainers-extra/features/apt-get-packages:1": {
|
||||||
"packages": "git-flow"
|
"packages": "git-flow"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue