Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci): missing ts modules from typegate image #577

Merged
merged 5 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,16 @@ jobs:
cargo install cross

cross build --release --locked --package meta-cli --target ${{ matrix.target }} --features typegate -v
tar czvf meta-cli-full-${{ steps.latest-tag.outputs.tag }}-${{ matrix.target }}.tar.gz "target/${{ matrix.target }}/release/meta${{ matrix.suffix }}"
# we cd next to the file so that the its parent dirs
# aren't present in the tar
cd target/${{ matrix.target }}/release/
tar czvf ../../../meta-cli-full-${{ steps.latest-tag.outputs.tag }}-${{ matrix.target }}.tar.gz "meta${{ matrix.suffix }}"
cd ../../../

cross build --release --locked --package meta-cli --target ${{ matrix.target }}
tar czvf meta-cli-${{ steps.latest-tag.outputs.tag }}-${{ matrix.target }}.tar.gz "target/${{ matrix.target }}/release/meta${{ matrix.suffix }}"
cd target/${{ matrix.target }}/release/
tar czvf ../../../meta-cli-${{ steps.latest-tag.outputs.tag }}-${{ matrix.target }}.tar.gz "meta${{ matrix.suffix }}"
cd ../../../
- uses: svenstaro/upload-release-action@v2
with:
tag: ${{ steps.latest-tag.outputs.tag }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ jobs:
push: false
cache-from: type=registry,ref=docker.io/zifeo/metatype-cache:ci
cache-to: type=registry,ref=docker.io/zifeo/metatype-cache:ci,mode=max
# check target runs extra validation steps in the Dockerfile
target: check
- name: Build without cache (external)
uses: docker/build-push-action@v5
if: "! steps.check.outputs.has-permission"
Expand All @@ -213,6 +215,7 @@ jobs:
platforms: linux/amd64
push: false
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/typegate:latest
target: check

test-full:
needs: changes
Expand Down
23 changes: 23 additions & 0 deletions dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,36 @@ COPY --from=builder /app/target/release/typegate /bin/typegate
COPY --from=builder /app/typegate/deno.jsonc /app/typegate/import_map.json ./typegate/
COPY --from=builder /app/typegate/engine/*.js /app/typegate/engine/*.ts ./typegate/engine/
COPY --from=builder /app/typegate/src ./typegate/src/
COPY --from=builder /app/typegate/tests ./typegate/tests/
COPY dev/LICENSE-Elastic-2.0.md LICENSE.md

# writeable
COPY --from=builder --chown=nonroot:nonroot /deno-dir /deno-dir
COPY --from=builder --chown=nonroot:nonroot /app/typegate/deno.lock ./typegate/
COPY --from=builder --chown=nonroot:nonroot /app/typegate/tmp ./

#
# run the checks in a separate target to avoid bloating
# the final image with the deno bin
# https://forums.docker.com/t/why-run-command-which-deletes-files-inflates-image-size/33670
FROM prd as check

# distroless-nonroot is by default the nonroot user
# which prevents us from removing the /deno bin down below
USER root

# we temporarliy copy the deno bin and run the type checker
# to make sure all required ts files are found in the image
COPY --from=deno-bin --chown=nonroot:nonroot /usr/bin/deno /bin/deno
zifeo marked this conversation as resolved.
Show resolved Hide resolved
RUN /bin/deno check \
--config /app/typegate/deno.jsonc \
/app/typegate/src/**/*.ts \
/app/typegate/tests/utils/**/*.ts \
&& rm /bin/deno

#
FROM prd as epoint

USER nonroot
EXPOSE 7890

Expand Down
23 changes: 17 additions & 6 deletions dev/Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
target
website
bindings
examples
**/.*
tmp
*
!dev/deps.ts
!dev/utils.ts
!dev/update.ts
!dev/LICENSE-Elastic-2.0.md
!libs/
!meta-cli/Cargo.toml
!typegraph/core/
!typegate/engine
!typegate/src
!typegate/standalone
!typegate/tests/utils
!typegate/deno.jsonc
!typegate/deno.lock
!typegate/import_map.json
!ghjk.ts
!Cargo.toml
55 changes: 0 additions & 55 deletions typegate/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions typegate/src/runtimes/deno/worker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright Metatype OÜ, licensed under the Elastic License 2.0.
// SPDX-License-Identifier: Elastic-2.0

// bring the unstable WorkerOptions api into scope
/// <reference lib="deno.worker" />
zifeo marked this conversation as resolved.
Show resolved Hide resolved

import { getLogger } from "../../log.ts";
import { Answer, Message } from "../patterns/messenger/types.ts";

Expand Down
Loading