own-dockerfile #166

Merged
philipp merged 32 commits from own-dockerfile into staging 2024-01-17 23:43:26 +01:00
3 changed files with 29 additions and 39 deletions
Showing only changes of commit c6da8b3db1 - Show all commits

6
.dockerignore Normal file
View File

@ -0,0 +1,6 @@
target/
db.sqlite
.history/
frontend/node_modules/*
/static/
/data-ergo/

View File

@ -7,16 +7,12 @@ env:
SSH_HOST: ${{ secrets.SSH_HOST }} SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_USER: ${{ secrets.SSH_USER }} SSH_USER: ${{ secrets.SSH_USER }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
CARGO_INCREMENTAL: 0
jobs: jobs:
test-frontend: test-frontend:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: rust:latest container: git.hofer.link/ruderverein-donau-linz/rowing-ci:latest
steps: 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 - uses: actions/checkout@v3
- name: Run Test DB Script - name: Run Test DB Script
run: ./test_db.sh run: ./test_db.sh
@ -26,8 +22,6 @@ jobs:
cd frontend && npm install && npm run build cd frontend && npm install && npm run build
- name: Install dependencies - name: Install dependencies
run: cd frontend && npm install run: cd frontend && npm install
- name: Install Playwright Browsers
run: cd frontend && npx playwright install --with-deps
- name: Run Playwright tests - name: Run Playwright tests
run: cd frontend && npx playwright test --workers 1 run: cd frontend && npx playwright test --workers 1
#- uses: actions/upload-artifact@v3 #- uses: actions/upload-artifact@v3
@ -39,13 +33,9 @@ jobs:
test-backend: test-backend:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: rust:latest container: git.hofer.link/ruderverein-donau-linz/rowing-ci:latest
steps: 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 - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -62,30 +52,10 @@ jobs:
deploy-staging: deploy-staging:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: rust:latest container: git.hofer.link/ruderverein-donau-linz/rowing-ci:latest
needs: [test_frontend, test_backend] needs: [test_frontend, test_backend]
if: github.ref == 'refs/heads/staging' if: github.ref == 'refs/heads/staging'
steps: 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 - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -122,15 +92,10 @@ jobs:
deploy-main: deploy-main:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: rust:latest container: git.hofer.link/ruderverein-donau-linz/rowing-ci:latest
needs: [test_frontend, test_backend] needs: [test_frontend, test_backend]
if: github.ref == 'refs/heads/main' if: github.ref == 'refs/heads/main'
steps: 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 - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3

19
Dockerfile Normal file
View File

@ -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