parent
4889284016
commit
b593556a9a
|
@ -1,4 +1,4 @@
|
||||||
name: Go
|
name: Node.js and Go
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -13,6 +13,11 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
|
||||||
- name: Set up Go 1.x
|
- name: Set up Go 1.x
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
|
@ -29,6 +34,11 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
|
||||||
- name: Set up Go 1.x
|
- name: Set up Go 1.x
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
|
@ -45,6 +55,11 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
|
||||||
- name: Set up Go 1.x
|
- name: Set up Go 1.x
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
|
@ -74,6 +89,11 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
|
||||||
- name: Set up Go 1.x
|
- name: Set up Go 1.x
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
|
|
10
Dockerfile
10
Dockerfile
|
@ -1,18 +1,20 @@
|
||||||
FROM node:16-alpine3.13 as build-web
|
FROM node:16-alpine3.13 as build-web
|
||||||
|
|
||||||
ARG NODE_ENV=production
|
|
||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN cd web && npm install
|
RUN cd web && npm install
|
||||||
|
|
||||||
|
ARG NODE_ENV=production
|
||||||
RUN cd web && npm run build
|
RUN cd web && npm run build
|
||||||
|
|
||||||
FROM golang:1.16-alpine3.13 as build
|
FROM golang:1.16-alpine3.13 as build
|
||||||
|
|
||||||
ARG CGO_ENABLED=0
|
RUN apk add \
|
||||||
|
make
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY --from=build-web . .
|
COPY --from=build-web . .
|
||||||
|
|
||||||
|
ARG CGO_ENABLED=0
|
||||||
RUN make TAGS=production
|
RUN make TAGS=production
|
||||||
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
|
|
6
Makefile
6
Makefile
|
@ -3,7 +3,7 @@ NPM = npm
|
||||||
|
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: web build
|
all: build
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
@ -12,11 +12,11 @@ clean:
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: upl
|
build: upl
|
||||||
|
|
||||||
upl: *.go web/*.tmpl
|
upl: *.go web/*.tmpl web
|
||||||
$(GO) build -ldflags="-s -w" -tags "$(TAGS)" -v -o upl
|
$(GO) build -ldflags="-s -w" -tags "$(TAGS)" -v -o upl
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test: web
|
||||||
$(GO) test -cover -bench=. -v ./...
|
$(GO) test -cover -bench=. -v ./...
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue