Skip to content

Commit

Permalink
feat: harden docker image and push on nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
Randoooom committed Jul 4, 2024
1 parent f4df6bc commit f30c18f
Show file tree
Hide file tree
Showing 9 changed files with 204 additions and 221 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ target/
common/target/
codegen/target/
tests/
docs/
111 changes: 22 additions & 89 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- name: Run clippy
run: cargo make clippy

test:
tests:
name: tests
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -104,91 +104,24 @@ jobs:
- name: Tests
run: cargo make ${{ matrix.database }}

# build-docs:
# needs: [ docs-lint ]
# name: build docs
# runs-on: ubuntu-latest
# steps:
# - uses: pnpm/action-setup@v2
# with:
# version: 8
#
# - name: Install toolchain
# uses: actions-rs/toolchain@v1
# with:
# toolchain: nightly
# override: true
#
# - name: Checkout Sources
# uses: actions/checkout@v4
#
# - name: Setup cache
# uses: Swatinem/rust-cache@v2
#
# - name: Install cargo-make
# uses: actions-rs/cargo@v1
# with:
# command: install
# args: cargo-make
#
# - name: Determine current pages artifact
# id: determine_pages_artifact
# uses: actions/github-script@v7
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# script: |
# const { data } = await github.rest.actions.listWorkflowRunsForRepo({
# owner: context.repo.owner,
# repo: context.repo.repo,
# branch: "main",
# status: "success",
# per_page: 1
# });
#
# core.setOutput("last_run", data.workflow_runs[0].id);
#
# - name: Download current pages artifact
# uses: actions/download-artifact@v4
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# run-id: ${{ steps.determine_pages_artifact.outputs.last_run }}
# name: github-pages
# path: ./
#
# - name: Extract pages artifact
# run: mkdir pages/ && tar -xvf artifact.tar -C pages/
#
# - name: Build docs
# uses: actions-rs/cargo@v1
# with:
# command: make
# args: docs_build
#
# - name: Prefix docs
# run: rm -Rf pages/nightly/ && mkdir -p pages/nightly/ && mv -f target/docs/ pages/nightly/docs/
#
# - name: Fix permissions
# run: |
# chmod -c -R +rX "pages/" | while read line; do
# echo "::warning title=Invalid file permissions automatically fixed::$line"
# done
#
# - name: Upload pages artifact
# uses: actions/upload-pages-artifact@v3
# with:
# path: pages/
# retention-days: 3

# deploy-pages:
# needs: [ build-docs, test ]
# runs-on: ubuntu-latest
# permissions:
# pages: write
# id-token: write
# environment:
# name: github-pages
# url: ${{ steps.deployment.outputs.page_url }}
# steps:
# - name: Deploy to pages
# id: deployment
# uses: actions/deploy-pages@v4
docker:
needs: [tests, clippy, check]
name: docker
runs-on: ubuntu-latest
steps:
- name: Checkout Sources
uses: actions/checkout@v4

- name: Login into repository
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ghcr.io/onelitefeathernet/feedback-fusion:nightly
12 changes: 5 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@ FROM rust:slim as build

ARG features=all-databases

RUN apt-get update
RUN apt-get install libssl-dev protobuf-compiler -y

# set toolchain
RUN rustup default nightly

COPY ./Cargo.toml .
COPY ./Cargo.lock .
COPY ./proto ./proto
COPY ./common ./common
COPY ./codegen ./codegen
COPY ./src ./src
COPY ./rust-toolchain.toml .

RUN cargo build --release --features $features
RUN apt-get update \
&& apt-get install libssl-dev protobuf-compiler libprotobuf-dev -y --no-install-recommends \
&& apt-get clean \
&& cargo build --release --features $features

FROM gcr.io/distroless/cc-debian12

Expand Down
51 changes: 15 additions & 36 deletions proto/feedback-fusion-v1.proto
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,7 @@ message NumberOptions {
string placeholder = 3;
}

message CreateFieldRequest {
string prompt = 1;
string title = 2;
optional string description = 3;
FieldType field_type = 4;

message FieldOptions {
oneof options {
TextOptions text = 5;
RatingOptions rating = 6;
Expand All @@ -185,21 +180,21 @@ message CreateFieldRequest {
}
}

message CreateFieldRequest {
string prompt = 1;
string title = 2;
optional string description = 3;
FieldType field_type = 4;
FieldOptions options = 5;
}

message Field {
string id = 1;
string prompt = 2;
string title = 3;
optional string description = 4;
FieldType field_type = 13;

oneof options {
TextOptions text = 5;
RatingOptions rating = 6;
CheckboxOptions checkbox = 7;
SelectionOptions selection = 8;
RangeOptions range = 9;
NumberOptions number = 10;
}
FieldOptions options = 5;

google.protobuf.Timestamp created_at = 11;
google.protobuf.Timestamp updated_at = 12;
Expand All @@ -221,18 +216,10 @@ message FieldPage {
}

message UpdateFieldRequest {
oneof options {
TextOptions text = 1;
RatingOptions rating = 2;
CheckboxOptions checkbox = 3;
SelectionOptions selection = 4;
RangeOptions range = 5;
NumberOptions number = 6;
}

optional string title = 8;
optional string description = 9;
string id = 10;
FieldOptions options = 1;
optional string title = 2;
optional string description = 3;
string id = 4;
}

message DeleteFieldRequest { string id = 1; }
Expand Down Expand Up @@ -282,15 +269,7 @@ message FieldResponse {
string id = 1;
string response = 2;
string field = 3;

oneof data {
TextResponse text = 4;
RatingResponse rating = 5;
CheckboxResponse checkbox = 6;
SelectionResponse selection = 7;
RangeResponse range = 8;
NumberResponse number = 9;
}
ResponseData data = 4;
}

message FieldResponseList {
Expand Down
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "nightly"
Loading

0 comments on commit f30c18f

Please sign in to comment.