diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c72545b..f1931df 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,6 +47,7 @@ jobs: - uses: docker/build-push-action@v2 with: push: true + platforms: linux/arm64 tags: docker.pkg.github.com/${{ github.repository }}/noolite:${{ github.sha }} latest: diff --git a/Dockerfile b/Dockerfile index 6968316..fa359c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,16 @@ -FROM alpine:latest as alpine +FROM --platform=linux/arm64 alpine:latest as alpine RUN apk --no-cache add tzdata zip ca-certificates WORKDIR /usr/share/zoneinfo # -0 means no compression. Needed because go's # tz loader doesn't handle compressed data. RUN zip -r -0 /zoneinfo.zip . -FROM golang:1.16 AS builder +FROM --platform=linux/arm64 golang:1.16 AS builder WORKDIR /gomod/noolite ADD . . -RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -o /go/bin/noolite ./cmd +RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o /go/bin/noolite ./cmd -FROM scratch +FROM --platform=linux/arm64 scratch # configurations WORKDIR /app # the timezone data: diff --git a/ansible/playbooks/deploy.yml b/ansible/playbooks/deploy.yml index 87894d0..5a7d5a9 100644 --- a/ansible/playbooks/deploy.yml +++ b/ansible/playbooks/deploy.yml @@ -1,6 +1,7 @@ --- - name: deploy hosts: rasp + gather_facts: no tasks: - name: login github docker registry docker_login: @@ -15,6 +16,7 @@ state: started pull: yes restart_policy: always + restart: yes devices: - "/dev/ttyUSB0:/dev/ttyUSB0" env: diff --git a/ansible/playbooks/prepare.yml b/ansible/playbooks/prepare.yml deleted file mode 100644 index 6ebd4a1..0000000 --- a/ansible/playbooks/prepare.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -- name: prepare - hosts: rasp - tasks: - - name: upgrade packages - become: yes - apt: - update_cahe: yes - upgrade: yes - - - name: install deps - become: yes - apt: - name: "{{ item }}" - state: latest - loop: - - apt-transport-https - - ca-certificates - - curl - - software-properties-common - - - name: install GPG key - become: yes - apt_key: - url: "https://download.docker.com/linux/ubuntu/gpg" - state: present - - - name: add apt repository - become: yes - apt_repository: - repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable" - state: present - - - name: install docker - become: yes - apt: - name: docker-ce - state: latest - update_cache: yes - - - name: docker permissions - block: - - set_fact: - user: "{{ ansible_env['USER'] }}" - - - name: ensure group "docker" exists - group: - name: docker - state: present - - - name: add currenct user to docker group - become: yes - user: - name: "{{ ansible_env['USER'] }}" - groups: docker - append: yes - - - name: fix docker permissions - become: yes - file: - path: "{{ ansible_env['HOME'] }}/.docker" - recurse: true - owner: "{{ ansible_env['USER'] }}" - group: docker