Skip to content
This repository has been archived by the owner on Nov 18, 2023. It is now read-only.

Commit

Permalink
Merge pull request #10 from Bidaya0/ci/add-frontend-ci
Browse files Browse the repository at this point in the history
ci(frontend): add build test.
  • Loading branch information
Bidaya0 authored Nov 21, 2022
2 parents e872c24 + 8430fec commit 0cde742
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/gotest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,26 @@ jobs:
- run: |
go test -v ./...
frontend-build-check:
name: frontend-build-check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup QEMU
uses: docker/setup-qemu-action@v1

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Build
uses: docker/build-push-action@v2
with:
file: ./frontend/Dockerfile
context: ./frontend
push: false
tags: |
bidaya0/gbatect-frontend:latest
Empty file added frontend/.dockerignore
Empty file.
15 changes: 15 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM golang:1.17 AS build-env
ADD . /go/src/app
WORKDIR /go/src/app
RUN go install
RUN go install github.com/gopherjs/gopherjs@latest
RUN gopherjs build -m *.go -o ./main.js


FROM nginx

COPY ./nginx.conf /etc/nginx/nginx.conf
COPY ./index.html /usr/share/nginx/html/
COPY --from=build-env /go/src/app/main.js /usr/share/nginx/html/

EXPOSE 80
30 changes: 30 additions & 0 deletions frontend/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;

#gzip on;
gzip on;
gzip_min_length 5k;
gzip_buffers 4 16k;
#gzip_http_version 1.0;
gzip_comp_level 3;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;

server {
listen 80;
server_name iast.huoxian.cn;
client_max_body_size 100M;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
}
}

0 comments on commit 0cde742

Please sign in to comment.