-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: build and publish data-dev container
- Loading branch information
1 parent
8717bef
commit 9031fbf
Showing
16 changed files
with
415 additions
and
888 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.git | ||
*Dockerfile* | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
name: e2e | ||
name: End-to-end tests | ||
|
||
on: | ||
pull_request: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Publish images | ||
|
||
on: | ||
push: | ||
branches: | ||
- jcd/images | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
image: | ||
- compile | ||
- data-dev | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: pi-base/${{ matrix.image }} | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Lint Dockerfiles | ||
uses: hadolint/hadolint-action@v3.1.0 | ||
with: | ||
dockerfile: images/${{ matrix.image }}/Dockerfile | ||
|
||
- name: Log in to the container registry | ||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: ${{ env.REGISTRY }}/pi-base/${{ matrix.image }} | ||
tags: | | ||
type=sha | ||
- name: Build and push | ||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | ||
with: | ||
context: . | ||
file: images/${{ matrix.image }}/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
name: test | ||
name: Unit tests | ||
|
||
on: | ||
push: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# See https://pnpm.io/docker | ||
FROM node:18-slim AS base | ||
|
||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
|
||
RUN corepack enable | ||
|
||
VOLUME /data | ||
|
||
COPY . /app | ||
WORKDIR /app | ||
|
||
FROM base AS prod-deps | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile | ||
|
||
FROM base AS build | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \ | ||
pnpm install --frozen-lockfile && \ | ||
pnpm run --filter core build && \ | ||
pnpm run --filter compile build && \ | ||
pnpm deploy --filter compile --prod /prod/compile | ||
|
||
FROM base | ||
COPY --from=build /prod/compile /app | ||
|
||
ENTRYPOINT ["node", "/app/dist/esm/main.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# See https://pnpm.io/docker | ||
FROM node:18-slim AS base | ||
|
||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
|
||
EXPOSE 3141/tcp | ||
EXPOSE 4173/tcp | ||
|
||
RUN corepack enable | ||
|
||
VOLUME /data | ||
|
||
COPY . /app | ||
WORKDIR /app | ||
|
||
COPY ./images/data-dev/entrypoint.sh /app/entrypoint.sh | ||
RUN chmod +x /app/entrypoint.sh | ||
|
||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile | ||
|
||
ENTRYPOINT ["/bin/bash", "/app/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pnpm run --filter compile dev & | ||
|
||
VITE_BUNDLE_SSE=true VITE_BUNDLE_HOST=/bundle pnpm run --filter viewer dev --host |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,39 @@ | ||
/** | ||
* Entry point for running as a Github action, with the local workspace | ||
* containing the data repository. Set GITHUB_WORKSPACE to use a different | ||
* data repository. | ||
*/ | ||
import * as core from '@actions/core' | ||
import * as fs from 'fs' | ||
import * as process from 'process' | ||
import { bundle as B } from '@pi-base/core' | ||
|
||
import load from './load.js' | ||
|
||
async function run(): Promise<void> { | ||
const repo: string = process.env.GITHUB_WORKSPACE || '.' | ||
const outpath: string = core.getInput('out') | ||
|
||
core.debug(`Compiling repo=${repo} to out=${outpath}`) | ||
async function run(repo = '.', out = 'bundle.json'): Promise<void> { | ||
log(`Compiling repo=${repo} to out=${out}`, 'debug') | ||
|
||
const { bundle, errors } = await load(repo) | ||
|
||
if (errors) { | ||
errors.forEach((messages, path) => { | ||
messages.forEach(message => { | ||
error(path, message) | ||
log(`file=${path}::${message}`, 'error') | ||
}) | ||
}) | ||
} | ||
|
||
if (errors || !bundle) { | ||
core.setFailed('Compilation finished with errors') | ||
return | ||
log('Compilation finished with errors', 'error') | ||
process.exit(1) | ||
} | ||
|
||
fs.writeFileSync(outpath, JSON.stringify(B.serialize(bundle))) | ||
fs.writeFileSync(`${repo}/${out}`, JSON.stringify(B.serialize(bundle))) | ||
} | ||
|
||
type Level = 'debug' | 'info' | 'error' | ||
|
||
function log(message: string, level: Level = 'info') { | ||
console.log(`::${level} ${message}`) | ||
} | ||
|
||
function error(file: string, message: string) { | ||
console.log(`::error file=${file}::${message}`) | ||
function fail(message: string) { | ||
log(message, 'error') | ||
process.exit(1) | ||
} | ||
|
||
run().catch(err => { | ||
core.setFailed(err.message) | ||
core.error(err.message) | ||
}) | ||
run(...process.argv.slice(2)).catch(err => fail(err.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"properties":[{"name":"Compact","aliases":[],"uid":"P000016","description":"A space $X$ is compact if every open cover of $X$ has a finite subcover.\n\nDefined on page 18 of {{doi:10.1007/978-1-4612-6290-9}}.","refs":[{"name":"Counterexamples in Topology","doi":"10.1007/978-1-4612-6290-9"},{"name":"Compact space on Wikipedia","wikipedia":"Compact_space"}]},{"name":"Countably compact","aliases":[],"uid":"P000019","description":"A space $X$ is countably compact if every countable open cover of $X$ has a finite subcover.\n\nDefined on page 19 of {{doi:10.1007/978-1-4612-6290-9}}.","refs":[{"name":"Counterexamples in Topology","doi":"10.1007/978-1-4612-6290-9"}]},{"name":"Connected","aliases":[],"uid":"P000036","description":"A space $X$ is connected if given any two disjoint open $U, V \\subset X$ with $U \\cup V = X$, one of $U$ or $V$ must be empty.\n\nDefined on page 7 of {{doi:10.1007/978-1-4612-6290-9}}.","refs":[{"name":"Counterexamples in Topology","doi":"10.1007/978-1-4612-6290-9"}]}],"spaces":[{"name":"Discrete topology on a two-point set","aliases":["Finite Discrete Topology"],"uid":"S000001","counterexamples_id":1,"description":"Let $X=2=\\{0,1\\}$ be the space containing two points and\nlet all subsets of $X$ be open.\n\nDefined as counterexample #1 (\"Finite Discrete Topology\")\nin {{doi:10.1007/978-1-4612-6290-9}}.","refs":[{"name":"Counterexamples in Topology","doi":"10.1007/978-1-4612-6290-9"},{"name":"Discrete Space on Wikipedia","wikipedia":"Discrete_space"}]},{"name":"Discrete Topology on a Countably Infinite Set","aliases":["Countable Discrete Topology"],"uid":"S000002","counterexamples_id":2,"description":"Let $X=\\omega=\\{0,1,2,\\dots\\}$ be the space containing countably-many\npoints and let all subsets of $X$ be open.\n\nDefined as counterexample #2 (\"Countable Discrete Topology\")\nin {{doi:10.1007/978-1-4612-6290-9}}.\n\n<!-- [[Proof of Topology]]\n1) $U=\\emptyset$ is open by definition. Let $U = X$ is open by definition.\n\n2) Let $A$ be an arbitrary union of the elements of any subcollection of $\\tau$. Since every element in the subcollection are subsets of $X$ their union must be a subset of $X$. Thus, $A$ is a subset of $X$ and is open by definition.\n\n3) Let $A$ be a finite intersection of elements from any subcollection of $\\tau$. Since every element in the subcollection are subsets of $X$ their intersection must necessarily be a subset of $X$. Thus, $A$ is a subset of $X$ and is open by definition. -->","refs":[{"name":"Counterexamples in Topology","doi":"10.1007/978-1-4612-6290-9"},{"name":"Discrete Space on Wikipedia","wikipedia":"Discrete_space"}]}],"theorems":[{"when":{"kind":"atom","property":"P000016","value":true},"then":{"kind":"atom","property":"P000019","value":true},"uid":"T000001","description":"Asserted on page 21 of {{doi:10.1007/978-1-4612-6290-9}}.","refs":[{"name":"Counterexamples in Topology","doi":"10.1007/978-1-4612-6290-9"}]}],"traits":[{"space":"S000001","property":"P000016","value":true,"uid":"T000008","description":"\n\nIf $X$ is finite any topology on $X$ is finite, and so any open cover of $X$ must be finite.\n\nSee item #8 for space #1 in {{doi:10.1007/978-1-4612-6290-9}}.\n","refs":[{"name":"Counterexamples in Topology","doi":"10.1007/978-1-4612-6290-9"}]},{"space":"S000001","property":"P000036","value":false,"uid":"T000009","description":"\n\nSince X consists of more than one point, X contains isolated points and is therefore clearly not connected.\n\nSee point #10 for space #1 in {{doi:10.1007/978-1-4612-6290-9}}.\n","refs":[{"name":"Counterexamples in Topology","doi":"10.1007/978-1-4612-6290-9"}]},{"space":"S000002","property":"P000036","value":false,"uid":"T000010","description":"\n\nX contains isolated points and is therefore clearly not connected.\n\nSee item #10 for space #2 in {{doi:10.1007/978-1-4612-6290-9}}.\n","refs":[{"name":"Counterexamples in Topology","doi":"10.1007/978-1-4612-6290-9"}]}],"version":{"ref":"test","sha":"c74d99cf46f6ed23e742f2617e9908294b4a608b"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.