build: fix gitea actions
This commit is contained in:
		
							parent
							
								
									503c674d5e
								
							
						
					
					
						commit
						0a21cc140a
					
				@ -6,8 +6,17 @@ on:
 | 
			
		||||
      - master
 | 
			
		||||
jobs:
 | 
			
		||||
  tests:
 | 
			
		||||
    uses: ./.gitea/workflows/test.yaml  # use the callable tests job to run tests
 | 
			
		||||
    secrets: inherit
 | 
			
		||||
    name: tests
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
    - uses: https://github.com/actions/checkout.git@v4
 | 
			
		||||
    - name: tests
 | 
			
		||||
      uses: nanobyte-public/rust-action@master
 | 
			
		||||
      with:
 | 
			
		||||
        args: |
 | 
			
		||||
          CARGO_HOME=./.cache cargo-nan \"Bearer ${{secrets.deployment_package}}\" cargo clippy -- -Dwarnings && \
 | 
			
		||||
          CARGO_HOME=./.cache cargo-nan \"Bearer ${{secrets.deployment_package}}\" cargo clippy --tests -- -Dwarnings && \
 | 
			
		||||
          CARGO_HOME=./.cache cargo-nan \"Bearer ${{secrets.deployment_package}}\" cargo test
 | 
			
		||||
  deploy:
 | 
			
		||||
    name: deploy
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
@ -27,5 +36,5 @@ jobs:
 | 
			
		||||
      run: echo "::set-output name=short_hash::$(git rev-parse --short HEAD)"
 | 
			
		||||
    - name: Build and push docker
 | 
			
		||||
      run: |
 | 
			
		||||
        docker build . -t git.nanobyte.cz/$GITHUB_REPOSITORY_OWNER/ovlach_backend:${{steps.git.outputs.short_hash}} --build-arg GITEA_TOKEN="Bearer ${{secrets.DEPLOYMENT_PACKAGE}}" && \
 | 
			
		||||
        docker push git.nanobyte.cz/$GITHUB_REPOSITORY_OWNER/ovlach_backend:${{steps.git.outputs.short_hash}}
 | 
			
		||||
        docker build . -t git.nanobyte.cz/$GITHUB_REPOSITORY_OWNER/ovlach_frontend:${{steps.git.outputs.short_hash}} --build-arg GITEA_TOKEN="Bearer ${{secrets.DEPLOYMENT_PACKAGE}}" && \
 | 
			
		||||
        docker push git.nanobyte.cz/$GITHUB_REPOSITORY_OWNER/ovlach_frontend:${{steps.git.outputs.short_hash}}
 | 
			
		||||
 | 
			
		||||
@ -1,11 +1,6 @@
 | 
			
		||||
name: test
 | 
			
		||||
run-name: test
 | 
			
		||||
on:
 | 
			
		||||
  workflow_call:
 | 
			
		||||
    secrets:
 | 
			
		||||
      DEPLOYMENT_PACKAGE:
 | 
			
		||||
        description: 'needed for checkout depenediencies'
 | 
			
		||||
        required: true
 | 
			
		||||
  push:
 | 
			
		||||
    branches:
 | 
			
		||||
      - '*'
 | 
			
		||||
@ -29,7 +24,7 @@ jobs:
 | 
			
		||||
          restore-keys: ${{github.repository}}-cache-cargo-clippy-v4
 | 
			
		||||
      - uses: nanobyte-public/rust-action@master
 | 
			
		||||
        with:
 | 
			
		||||
          args: CARGO_HOME=./.cache cargo-nan \"Bearer ${{secrets.DEPLOYMENT_PACKAGE}}\" cargo clippy -- -Dwarnings
 | 
			
		||||
          args: CARGO_HOME=./.cache cargo-nan \"Bearer ${{secrets.deployment_package}}\" cargo clippy -- -Dwarnings
 | 
			
		||||
      - uses: https://gitea.com/wolfogre/cache/save@v3
 | 
			
		||||
        if: steps.cache.outputs.cache-hit != 'true'
 | 
			
		||||
        with:
 | 
			
		||||
@ -57,7 +52,7 @@ jobs:
 | 
			
		||||
      - uses: nanobyte-public/rust-action@master
 | 
			
		||||
        with:
 | 
			
		||||
          args: |
 | 
			
		||||
            CARGO_HOME=./.cache cargo-nan \"Bearer ${{secrets.DEPLOYMENT_PACKAGE}}\" cargo test
 | 
			
		||||
            CARGO_HOME=./.cache cargo-nan \"Bearer ${{secrets.deployment_package}}\" cargo test
 | 
			
		||||
      - uses: https://gitea.com/wolfogre/cache/save@v3
 | 
			
		||||
        if: steps.cache.outputs.cache-hit != 'true'
 | 
			
		||||
        with:
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										30
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								Dockerfile
									
									
									
									
									
								
							@ -1,14 +1,20 @@
 | 
			
		||||
FROM  rust:1.74.0-slim-bookworm AS builder
 | 
			
		||||
COPY . /app
 | 
			
		||||
WORKDIR /app
 | 
			
		||||
RUN mkdir ~/.ssh
 | 
			
		||||
RUN apt-get update && apt-get install -y ssh && rm -rf /var/cache/apt*
 | 
			
		||||
RUN ssh-keyscan gitlab.nanobyte.cz >> /root/.ssh/known_hosts
 | 
			
		||||
RUN cargo build --release
 | 
			
		||||
FROM git.nanobyte.cz/nanobyte/nano-rust:1.74.4e44cba AS builder
 | 
			
		||||
ARG PACKAGE_NAME="ovlach_frontend"
 | 
			
		||||
ARG GITEA_TOKEN
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
FROM rust:1.74.0-slim-bookworm as runner
 | 
			
		||||
RUN mkdir /app
 | 
			
		||||
COPY --from=builder /app/target/release/ovlach_frontend /app 
 | 
			
		||||
COPY ./templates /app/templates
 | 
			
		||||
ENTRYPOINT ["/app/ovlach_frontend"]
 | 
			
		||||
COPY . /data/
 | 
			
		||||
RUN cd /data && cargo-nan "${GITEA_TOKEN}" cargo build --release
 | 
			
		||||
 | 
			
		||||
FROM git.nanobyte.cz/nanobyte/nano-rust:1.74.4e44cba
 | 
			
		||||
ARG PACKAGE_NAME="ovlach_frontend"
 | 
			
		||||
ARG GITEA_TOKEN
 | 
			
		||||
COPY --from=builder /data/target/release/${PACKAGE_NAME} /bin
 | 
			
		||||
RUN mkdir /rund
 | 
			
		||||
COPY Rocket.toml /rund
 | 
			
		||||
COPY templates/* /rund/templates/
 | 
			
		||||
WORKDIR /rund
 | 
			
		||||
EXPOSE 8000
 | 
			
		||||
ENV ROCKET_ADDRESS=0.0.0.0
 | 
			
		||||
ENV PACKAGE_NAME=${PACKAGE_NAME}
 | 
			
		||||
ENTRYPOINT $PACKAGE_NAME
 | 
			
		||||
 | 
			
		||||
@ -9,3 +9,4 @@ cv_backend_path = "http://localhost:8002"
 | 
			
		||||
contact_service = "http://localhost:8004"
 | 
			
		||||
pdf_service = "http://localhost:8003"
 | 
			
		||||
default_person_name = "ovlach"
 | 
			
		||||
port = 8000
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user