casdoor/Dockerfile

38 lines
1.2 KiB
Docker
Raw Normal View History

2021-12-12 22:28:14 +08:00
FROM golang:1.17.5 AS BACK
WORKDIR /go/src/casdoor
COPY . .
2022-04-13 14:04:40 +08:00
RUN ./build.sh && apt update && apt install wait-for-it && chmod +x /usr/bin/wait-for-it
2021-12-12 22:28:14 +08:00
FROM node:16.13.0 AS FRONT
WORKDIR /web
COPY ./web .
RUN yarn config set registry https://registry.npmmirror.com
2021-09-21 00:00:33 +08:00
RUN yarn install && yarn run build
FROM debian:latest AS ALLINONE
RUN apt update
RUN apt install -y ca-certificates && update-ca-certificates
RUN apt install -y mariadb-server mariadb-client && mkdir -p web/build && chmod 777 /tmp
LABEL MAINTAINER="https://casdoor.org/"
COPY --from=BACK /go/src/casdoor/ ./
COPY --from=BACK /usr/bin/wait-for-it ./
COPY --from=FRONT /web/build /web/build
CMD chmod 777 /tmp && service mariadb start&&\
if [ "${MYSQL_ROOT_PASSWORD}" = "" ] ;then MYSQL_ROOT_PASSWORD=123456 ; fi&&\
mysqladmin -u root password ${MYSQL_ROOT_PASSWORD} &&\
./wait-for-it localhost:3306 -- ./server --createDatabase=true
FROM alpine:latest
2021-09-21 01:06:57 +08:00
RUN sed -i 's/https/http/' /etc/apk/repositories
RUN apk add curl
RUN apk add ca-certificates && update-ca-certificates
LABEL MAINTAINER="https://casdoor.org/"
COPY --from=BACK /go/src/casdoor/ ./
COPY --from=BACK /usr/bin/wait-for-it ./
RUN mkdir -p web/build && apk add --no-cache bash coreutils
COPY --from=FRONT /web/build /web/build
2022-01-22 15:50:48 +08:00
CMD ./server