diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2a49406..748ebac 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -30,4 +30,38 @@ jobs: - name: Push the Docker image to GitHub Container Registry run: | docker push ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):latest - docker push ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):${{ github.sha }} \ No newline at end of file + docker push ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):${{ github.sha }} + + + build_arm: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Log in to GitHub Docker Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build the Docker image + run: | + docker buildx build --platform linux/arm64 -t ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):latest-arm64 \ + -t ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):${{ github.sha }}-arm64 . + + - name: Push the Docker image to GitHub Container Registry + run: | + docker push ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):latest-arm64 + docker push ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):${{ github.sha }}-arm64 \ No newline at end of file diff --git a/README.md b/README.md index 6f41052..07f316e 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,12 @@ wget https://raw.githubusercontent.com/Sn0wAlice/MatryRiska/refs/heads/main/dock docker-compose up ``` +(arm64) +```bash +wget https://raw.githubusercontent.com/Sn0wAlice/MatryRiska/refs/heads/main/docker-compose-arm.yml +docker-compose up +``` + ### 2. Using cargo ```bash ## Step 1: configure mysql db (can use docker-compose-dev.yml) diff --git a/docker-compose-arm.yml b/docker-compose-arm.yml new file mode 100644 index 0000000..995904f --- /dev/null +++ b/docker-compose-arm.yml @@ -0,0 +1,37 @@ +version: '3.8' + +services: + mysql: + image: mysql:8.0 # You can choose another version of MySQL if needed + container_name: matryriska-mysql + environment: + MYSQL_ROOT_PASSWORD: rootpassword # Set your root password + MYSQL_DATABASE: matryriska # This creates the database on startup + MYSQL_USER: matryriska # Optional: Set up an additional user + MYSQL_PASSWORD: StrongPassword123 # Optional: Set a password for the user + networks: + matryriska-net: + ipv4_address: 172.20.0.2 # Assign a fixed IP address + volumes: + - mysql_data:/var/lib/mysql # Persist MySQL data + ports: + - "3306:3306" # Expose MySQL port + + web: + image: ghcr.io/sn0walice/matryriska:latest-arm + container_name: matryriska-web + networks: + matryriska-net: + ipv4_address: 172.20.0.3 # Assign a fixed IP address for the web container + ports: + - "8080:8080" # Expose the web service port + +volumes: + mysql_data: + +networks: + matryriska-net: + driver: bridge + ipam: + config: + - subnet: 172.20.0.0/16 # Define a custom subnet diff --git a/src/assets/init.rs b/src/assets/init.rs index 154989a..8573452 100644 --- a/src/assets/init.rs +++ b/src/assets/init.rs @@ -46,7 +46,7 @@ pub async fn get_assets(path: web::Path) -> impl Responder { }; // return file (force type gif) - return HttpResponse::Ok().content_type(file_type.unwrap()["type"].as_str().unwrap()).body(file); + return HttpResponse::Ok().content_type(file_type.unwrap()["type"].as_str().unwrap()).insert_header(("Cache-Control", "3600")).body(file); } // return 404