Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ARM64 compatibility issues #192

Merged
merged 2 commits into from Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
bin
data
docs
guacd
# guacd
logs
playground
screenshot
Expand Down
122 changes: 95 additions & 27 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,109 @@
name: Docker image
name: Docker next-terminal Build

on:
push:
branches:
- "master"
paths-ignore:
- ".gitignore"
- "*.md"
- "*.png"
workflow_dispatch:
inputs:
days:
description: 'Number of days.'
required: true
default: "20"

jobs:
deploy:
DOCKERHUB_next-terminal_Build:
name: Docker next-terminal Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

- uses: actions/setup-node@v2
-
name: Private Actions Checkout
uses: actions/checkout@v2.3.4
-
name: Docker Setup QEMU
uses: docker/setup-qemu-action@v1.2.0
-
name: Docker Setup Buildx
uses: docker/setup-buildx-action@v1.6.0
-
name: node Setup
uses: actions/setup-node@v2
with:
node-version: '14'

- run: |
-
name: npm install
run: |
cd web
npm install
npm run build
-
name: Docker Login
uses: docker/login-action@v1.10.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
-
name: Build and push Docker images
uses: docker/build-push-action@v2.7.0
with:
context: .
platforms: linux/arm64,linux/amd64
file: Dockerfile
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/next-terminal:latest
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/next-terminal:cache
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/next-terminal:cache,mode=max

- name: Log into registry
run: echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
DOCKERHUB_Guacd_Build:
name: Docker Guacd Build
runs-on: ubuntu-latest
steps:
-
name: Private Actions Checkout
uses: actions/checkout@v2.3.4
-
name: Docker Setup QEMU
uses: docker/setup-qemu-action@v1.2.0
-
name: Docker Setup Buildx
uses: docker/setup-buildx-action@v1.6.0
-
name: Docker Login
uses: docker/login-action@v1.10.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
-
name: Build and push Docker images
uses: docker/build-push-action@v2.7.0
with:
context: .
platforms: linux/arm64,linux/amd64
file: guacd/Dockerfile
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/guacd:1.3.0
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/guacd:cache
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/guacd:cache,mode=max

- name: Build and push image
run: |
docker build -t ghcr.io/${{ github.repository_owner }}/next-terminal -f Dockerfile .
docker push ghcr.io/${{ github.repository_owner }}/next-terminal

- name: Push to Docker Hub
uses: docker/build-push-action@v1
DOCKERHUB_Hub_Description:
needs: [DOCKERHUB_next-terminal_Build, DOCKERHUB_Guacd_Build]
name: Docker Build PHP_INIT
runs-on: ubuntu-latest
steps:
-
name: Private Actions Checkout
uses: actions/checkout@v2.3.4
-
name: Docker Hub Description
uses: peter-evans/dockerhub-description@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: ${{ secrets.DOCKERHUB_USERNAME }}/next-terminal
-
name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@main
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ${{ github.repository_owner }}/next-terminal
tag_with_ref: true
token: ${{ secrets.TOKEN_GITHUB }}
repository: ${{ github.repository }}
retain_days: ${{ github.event.inputs.days }}
keep_minimum_runs: 3
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ COPY . .

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN apk add gcc g++
RUN go env && CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -a -ldflags '-linkmode external -extldflags "-static"' -o next-terminal main.go
RUN go env;ARCH="$(arch)";case "$ARCH" in 'x86_64') export ARCH='amd64';echo $ARCH;; 'aarch64') export ARCH='arm64';echo $ARCH;; 'i386') export ARCH='i386';echo $ARCH;; esac;CGO_ENABLED=1 GOOS=linux GOARCH=$ARCH go build -a -ldflags '-linkmode external -extldflags "-static"' -o next-terminal main.go

FROM alpine:latest

Expand Down
6 changes: 3 additions & 3 deletions guacd/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM guacamole/guacd:1.3.0
FROM xrsec/guacd:1.3.0

LABEL MAINTAINER="helloworld1024@foxmail.com"

COPY ./fonts/Menlo-Regular.ttf /usr/share/fonts/
COPY ./fonts/SourceHanSansCN-Regular.otf /usr/share/fonts/
COPY ./guacd/fonts/Menlo-Regular.ttf /usr/share/fonts/
COPY ./guacd/fonts/SourceHanSansCN-Regular.otf /usr/share/fonts/

RUN mkfontscale && mkfontdir && fc-cache