-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Setup sveltekit for node * Add Dockerfile configs for ui, queue, and api * Add workflow for pushing images * Update variables and env vars * Add prereleased and released triggers * Remove env block
- Loading branch information
1 parent
1998398
commit 6679e7c
Showing
7 changed files
with
306 additions
and
4 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,82 @@ | ||
name: build & push images | ||
|
||
on: | ||
release: | ||
types: | ||
- prereleased | ||
- released | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get release version | ||
id: version | ||
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | ||
|
||
- name: Install doctl | ||
uses: digitalocean/action-doctl@v2 | ||
with: | ||
token: ${{ secrets.DO_REGISTRY_KEY }} | ||
|
||
- name: Log in to DO Container Registry | ||
run: doctl registry login --expiry-seconds 600 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
# Build and push API image | ||
- name: Build and push API image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: config/api.Dockerfile | ||
push: true | ||
platforms: linux/amd64 | ||
tags: | | ||
${{ secrets.DO_REGISTRY }}/${{ env.API_IMAGE }}:latest | ||
${{ secrets.DO_REGISTRY }}/${{ env.API_IMAGE }}:${{ steps.version.outputs.VERSION }} | ||
cache-from: type=registry,ref=${{ secrets.DO_REGISTRY }}/${{ env.API_IMAGE }}:buildcache | ||
cache-to: type=registry,ref=${{ secrets.DO_REGISTRY }}/${{ env.API_IMAGE }}:buildcache,mode=max | ||
|
||
# Build and push Queue image | ||
- name: Build and push Queue image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: config/queue.Dockerfile | ||
push: true | ||
platforms: linux/amd64 | ||
tags: | | ||
${{ secrets.DO_REGISTRY }}/${{ env.QUEUE_IMAGE }}:latest | ||
${{ secrets.DO_REGISTRY }}/${{ env.QUEUE_IMAGE }}:${{ steps.version.outputs.VERSION }} | ||
cache-from: type=registry,ref=${{ secrets.DO_REGISTRY }}/${{ env.QUEUE_IMAGE }}:buildcache | ||
cache-to: type=registry,ref=${{ secrets.DO_REGISTRY }}/${{ env.QUEUE_IMAGE }}:buildcache,mode=max | ||
|
||
# Build and push UI image | ||
- name: Build and push UI image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: config/ui.Dockerfile | ||
push: true | ||
platforms: linux/amd64 | ||
tags: | | ||
${{ secrets.DO_REGISTRY }}/${{ env.UI_IMAGE }}:latest | ||
${{ secrets.DO_REGISTRY }}/${{ env.UI_IMAGE }}:${{ steps.version.outputs.VERSION }} | ||
cache-from: type=registry,ref=${{ secrets.DO_REGISTRY }}/${{ env.UI_IMAGE }}:buildcache | ||
cache-to: type=registry,ref=${{ secrets.DO_REGISTRY }}/${{ env.UI_IMAGE }}:buildcache,mode=max | ||
|
||
- name: Image digest | ||
run: | | ||
echo "API image digest: $(doctl registry repository digest-list ${{ env.API_IMAGE }} --format Tag,Digest --no-header | grep latest)" | ||
echo "Queue image digest: $(doctl registry repository digest-list ${{ env.QUEUE_IMAGE }} --format Tag,Digest --no-header | grep latest)" | ||
echo "UI image digest: $(doctl registry repository digest-list ${{ env.UI_IMAGE }} --format Tag,Digest --no-header | grep latest)" |
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,53 @@ | ||
# Build stage | ||
FROM --platform=$BUILDPLATFORM rust:1.82-slim-bullseye as builder | ||
|
||
# Install build dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
pkg-config \ | ||
libssl-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Create a new empty shell project | ||
WORKDIR /app | ||
|
||
# Copy workspace configuration | ||
COPY Cargo.toml Cargo.lock ./ | ||
|
||
# Copy all workspace members | ||
COPY packages/db ./packages/db | ||
COPY packages/vod ./packages/vod | ||
COPY services/forge-queue ./services/forge-queue | ||
COPY services/silo-api ./services/silo-api | ||
|
||
# Build the project for release | ||
WORKDIR /app | ||
RUN --mount=type=cache,target=/usr/local/cargo/registry \ | ||
--mount=type=cache,target=/app/target \ | ||
cargo build --release -p api && \ | ||
cp /app/target/release/api /usr/local/bin/api | ||
|
||
# Runtime stage | ||
FROM --platform=$TARGETPLATFORM debian:bullseye-slim | ||
|
||
# Install runtime dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
ca-certificates \ | ||
libssl1.1 \ | ||
libpq5 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Create uploads directory | ||
RUN mkdir -p /app/uploads && \ | ||
chmod 777 /app/uploads | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Copy the binary from builder | ||
COPY --from=builder /usr/local/bin/api /usr/local/bin/api | ||
|
||
# Expose the default port | ||
EXPOSE 3000 | ||
|
||
# Set the entrypoint | ||
ENTRYPOINT ["/usr/local/bin/api"] |
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,43 @@ | ||
# Build stage | ||
FROM --platform=$BUILDPLATFORM rust:1.82-slim-bullseye as builder | ||
|
||
# Install build dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
pkg-config \ | ||
libssl-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Create a new empty shell project | ||
WORKDIR /app | ||
|
||
# Copy workspace configuration | ||
COPY Cargo.toml Cargo.lock ./ | ||
|
||
# Copy all workspace members | ||
COPY packages/db ./packages/db | ||
COPY packages/vod ./packages/vod | ||
COPY services/forge-queue ./services/forge-queue | ||
COPY services/silo-api ./services/silo-api | ||
|
||
# Build the project for release | ||
WORKDIR /app/services/forge-queue | ||
RUN --mount=type=cache,target=/usr/local/cargo/registry \ | ||
--mount=type=cache,target=/app/target \ | ||
cargo build --release && \ | ||
cp /app/target/release/queue /usr/local/bin/queue | ||
|
||
# Runtime stage | ||
FROM --platform=$TARGETPLATFORM debian:bullseye-slim | ||
|
||
# Install runtime dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
ca-certificates \ | ||
ffmpeg \ | ||
libpq5 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy the binary from builder | ||
COPY --from=builder /usr/local/bin/queue /usr/local/bin/queue | ||
|
||
# Set the entrypoint | ||
ENTRYPOINT ["/usr/local/bin/queue"] |
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,38 @@ | ||
# Build stage | ||
FROM --platform=$BUILDPLATFORM node:20-slim as builder | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Copy package files | ||
COPY services/barn-ui/package.json services/barn-ui/yarn.lock ./ | ||
|
||
# Install dependencies | ||
RUN yarn install --frozen-lockfile | ||
|
||
# Copy source files | ||
COPY services/barn-ui . | ||
|
||
# Build the application | ||
RUN yarn build | ||
|
||
# Runtime stage | ||
FROM --platform=$TARGETPLATFORM node:20-slim | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Copy package files for production dependencies | ||
COPY services/barn-ui/package.json services/barn-ui/yarn.lock ./ | ||
|
||
# Install production dependencies only | ||
RUN yarn install --production --frozen-lockfile | ||
|
||
# Copy built application from builder | ||
COPY --from=builder /app/build ./build | ||
|
||
# Expose default SvelteKit port | ||
EXPOSE 3000 | ||
|
||
# Start the application | ||
CMD ["node", "build"] |
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