forked from Open-CT/OpenPBL
fix: dockerfile
This commit is contained in:
parent
512d4f2003
commit
cd9535a9ec
44
Dockerfile
44
Dockerfile
|
@ -1,27 +1,21 @@
|
||||||
FROM golang:1.16-rc-buster
|
FROM node:lts-alpine as front-end
|
||||||
WORKDIR /openpbl
|
WORKDIR /openpbl-landing
|
||||||
COPY ./ /openpbl
|
COPY openpbl-landing/package.json package.json
|
||||||
RUN go env -w CGO_ENABLED=0 GOPROXY=https://goproxy.io,direct GOOS=linux GOARCH=amd64 \
|
RUN yarn install
|
||||||
&& apt update && apt install sudo \
|
COPY openpbl-landing/. .
|
||||||
&& wget https://nodejs.org/dist/v12.22.0/node-v12.22.0-linux-x64.tar.gz \
|
RUN set NODE_OPTIONS=--max_old_space_size=2048
|
||||||
&& sudo tar xf node-v12.22.0-linux-x64.tar.gz \
|
RUN yarn build
|
||||||
&& sudo apt install wait-for-it
|
|
||||||
ENV PATH=$PATH:/openpbl/node-v12.22.0-linux-x64/bin
|
|
||||||
RUN npm install -g yarn \
|
|
||||||
&& cd openpbl-landing \
|
|
||||||
&& yarn install \
|
|
||||||
&& yarn run build \
|
|
||||||
&& rm -rf node_modules \
|
|
||||||
&& cd /openpbl \
|
|
||||||
&& go build main.go
|
|
||||||
|
|
||||||
FROM alpine:3.7
|
|
||||||
|
FROM golang:alpine3.13
|
||||||
ENV RUNMODE=prod
|
ENV RUNMODE=prod
|
||||||
COPY --from=0 /openpbl /
|
WORKDIR /OpenPBL
|
||||||
COPY --from=0 /usr/bin/wait-for-it /
|
RUN go env -w GO111MODULE=on ;go env -w GOPROXY=https://goproxy.cn,direct
|
||||||
RUN set -eux \
|
RUN apk add --update alpine-sdk
|
||||||
&& sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \
|
COPY go.mod .
|
||||||
&& apk update \
|
RUN go mod download
|
||||||
&& apk upgrade \
|
COPY . .
|
||||||
&& apk add bash
|
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
|
||||||
CMD ./wait-for-it db:3306 && ./main
|
COPY --from=front-end /openpbl-landing/build openpbl-landing/build
|
||||||
|
RUN go build
|
||||||
|
ENTRYPOINT ["./OpenPBL"]
|
||||||
|
|
Loading…
Reference in New Issue