Ensure Nods.js and Go in Docker build

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-09-24 21:53:59 +02:00
parent 07d584ccf2
commit aac54add2d
No known key found for this signature in database
GPG Key ID: 0066F03ED215AD7D
4 changed files with 34 additions and 7 deletions

View File

@ -1 +1 @@
src
src/node_modules

View File

@ -1,20 +1,29 @@
FROM golang:alpine as builder
FROM luzifer/archlinux as builder
ENV CGO_ENABLED=0 \
GOPATH=/go
COPY . /go/src/github.com/Luzifer/ots
WORKDIR /go/src/github.com/Luzifer/ots
RUN set -ex \
&& apk add --update \
&& pacman --noconfirm -Syy \
&& pacman --noconfirm -S \
curl \
git \
go \
make \
nodejs-lts-fermium \
npm \
tar \
unzip \
&& make -C src -f ../Makefile generate-inner \
&& make download_libs \
&& go install \
-ldflags "-X main.version=$(git describe --tags --always || echo dev)" \
-mod=readonly
FROM alpine:latest
LABEL maintainer "Knut Ahlers <knut@ahlers.me>"

View File

@ -1,16 +1,29 @@
FROM golang:alpine as builder
FROM luzifer/archlinux as builder
ENV CGO_ENABLED=0
ENV CGO_ENABLED=0 \
GOPATH=/go
COPY . /go/src/github.com/Luzifer/ots
WORKDIR /go/src/github.com/Luzifer/ots
RUN set -ex \
&& apk add --update git \
&& pacman --noconfirm -Syy \
&& pacman --noconfirm -S \
curl \
git \
go \
make \
nodejs-lts-fermium \
npm \
tar \
unzip \
&& make -C src -f ../Makefile generate-inner \
&& make download_libs \
&& go install \
-ldflags "-X main.version=$(git describe --tags --always || echo dev)" \
-mod=readonly
FROM scratch
LABEL maintainer "Knut Ahlers <knut@ahlers.me>"

View File

@ -5,7 +5,12 @@ default: generate download_libs
generate:
docker run --rm -i -v $(CURDIR):$(CURDIR) -w $(CURDIR)/src node:14-alpine \
sh -exc "npx npm@lts ci && npx npm@lts run build && chown -R $(shell id -u) ../frontend node_modules"
make generate-inner
generate-inner:
npx npm@lts ci
npx npm@lts run build
chown -R $(shell id -u) ../frontend node_modules
publish: generate download_libs
curl -sSLo golang.sh https://raw.githubusercontent.com/Luzifer/github-publish/master/golang.sh