Skip to content

Commit

Permalink
add arm
Browse files Browse the repository at this point in the history
  • Loading branch information
Sn0wAlice committed Oct 23, 2024
1 parent 3af1905 commit 43429ca
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 2 deletions.
36 changes: 35 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
37 changes: 37 additions & 0 deletions docker-compose-arm.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/assets/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub async fn get_assets(path: web::Path<String>) -> 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
Expand Down

0 comments on commit 43429ca

Please sign in to comment.