From c6da8b3db1525abe5a0d1e397545a1c8b261475d Mon Sep 17 00:00:00 2001 From: philipp Date: Wed, 17 Jan 2024 18:09:29 +0100 Subject: [PATCH] try --- .dockerignore | 6 ++++++ .gitea/workflows/action.yml | 43 ++++--------------------------------- Dockerfile | 19 ++++++++++++++++ 3 files changed, 29 insertions(+), 39 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..cf6570b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +target/ +db.sqlite +.history/ +frontend/node_modules/* +/static/ +/data-ergo/ diff --git a/.gitea/workflows/action.yml b/.gitea/workflows/action.yml index 493fbc9..19a21ab 100644 --- a/.gitea/workflows/action.yml +++ b/.gitea/workflows/action.yml @@ -7,16 +7,12 @@ env: SSH_HOST: ${{ secrets.SSH_HOST }} SSH_USER: ${{ secrets.SSH_USER }} SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} - CARGO_INCREMENTAL: 0 jobs: test-frontend: runs-on: ubuntu-latest - container: rust:latest + container: git.hofer.link/ruderverein-donau-linz/rowing-ci:latest steps: - - name: Setup Environment - run: | - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y - uses: actions/checkout@v3 - name: Run Test DB Script run: ./test_db.sh @@ -26,8 +22,6 @@ jobs: cd frontend && npm install && npm run build - name: Install dependencies run: cd frontend && npm install - - name: Install Playwright Browsers - run: cd frontend && npx playwright install --with-deps - name: Run Playwright tests run: cd frontend && npx playwright test --workers 1 #- uses: actions/upload-artifact@v3 @@ -39,13 +33,9 @@ jobs: test-backend: runs-on: ubuntu-latest - container: rust:latest + container: git.hofer.link/ruderverein-donau-linz/rowing-ci:latest steps: - - name: Setup Environment - run: | - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y - - name: Checkout uses: actions/checkout@v3 @@ -62,30 +52,10 @@ jobs: deploy-staging: runs-on: ubuntu-latest - container: rust:latest + container: git.hofer.link/ruderverein-donau-linz/rowing-ci:latest needs: [test_frontend, test_backend] if: github.ref == 'refs/heads/staging' steps: - - name: Setup Environment - run: | - rustup target add $CARGO_TARGET - apt-get update -qq && apt-get install -y -qq pkg-config sshpass musl musl-tools sqlite3 curl gnupg libssl-dev - - # Handling NodeSource GPG key - curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key -o nodesource.gpg.key - if [ -f /etc/apt/keyrings/nodesource.gpg ]; then - rm /etc/apt/keyrings/nodesource.gpg - fi - gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg nodesource.gpg.key - - # Adding NodeSource repository - echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list - - # Installing Node.js and npm - apt-get update - apt-get install nodejs -y - apt-get install npm -y - - name: Checkout uses: actions/checkout@v3 @@ -122,15 +92,10 @@ jobs: deploy-main: runs-on: ubuntu-latest - container: rust:latest + container: git.hofer.link/ruderverein-donau-linz/rowing-ci:latest needs: [test_frontend, test_backend] if: github.ref == 'refs/heads/main' steps: - - name: Setup Environment - run: | - rustup target add $CARGO_TARGET - apt-get update -qq && apt-get install -y -qq pkg-config sshpass musl musl-tools sqlite3 curl gnupg libssl-dev && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y - - name: Checkout uses: actions/checkout@v3 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dfda4da --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM rust:latest + +# COPY . / + + +RUN apt-get update && apt-get install -y sqlite3 + +# nodejs +RUN apt-get install -y curl && \ + curl -sL https://deb.nodesource.com/setup_21.x | bash - && \ + apt-get install -y nodejs + +# playwright +RUN npx playwright install --with-deps + +# deployment +RUN rustup target add x86_64-unknown-linux-musl +RUN apt-get install -y -qq pkg-config sshpass musl musl-tools curl gnupg libssl-dev +