mirror of https://github.com/rocboss/paopao-ce
parent
79060468ba
commit
4254975afd
@ -1,26 +1,32 @@
|
||||
# build app
|
||||
FROM golang AS build-env
|
||||
|
||||
ADD . /paopao-ce
|
||||
# build frontend
|
||||
FROM node:18-alpine as frontend
|
||||
WORKDIR /web
|
||||
COPY web/ ./
|
||||
RUN echo 'VITE_HOST=""'>.env && yarn && yarn build
|
||||
|
||||
# build backend
|
||||
FROM golang:1.18-alpine AS backend
|
||||
RUN apk --no-cache --no-progress add --virtual \
|
||||
build-deps \
|
||||
build-base \
|
||||
git
|
||||
|
||||
WORKDIR /paopao-ce
|
||||
COPY . .
|
||||
COPY --from=frontend /web/dist ./web/dist
|
||||
ENV GOPROXY=https://goproxy.cn
|
||||
RUN make build TAGS='embed'
|
||||
|
||||
RUN CGO_ENABLED=0 go build .
|
||||
|
||||
# safe image
|
||||
FROM alpine
|
||||
|
||||
FROM alpine:3.16
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
RUN apk update && apk add --no-cache ca-certificates && update-ca-certificates
|
||||
|
||||
COPY --from=build-env /paopao-ce/paopao-ce /usr/bin/paopao-ce
|
||||
COPY --from=build-env /paopao-ce/assets/comic.ttf /assets/comic.ttf
|
||||
COPY --from=build-env /paopao-ce/configs /configs
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["paopao-ce"]
|
||||
WORKDIR /app/paopao-ce
|
||||
COPY --from=backend /paopao-ce/release/paopao-ce .
|
||||
COPY assets ./assets
|
||||
COPY configs ./configs
|
||||
|
||||
# HEALTHCHECK
|
||||
VOLUME ["/app/paopao-ce/assets", "/app/paopao-ce/configs"]
|
||||
EXPOSE 8008
|
||||
HEALTHCHECK --interval=5s --timeout=3s --retries=3 CMD ps -ef | grep paopao-ce || exit 1
|
||||
ENTRYPOINT ["/app/paopao-ce/paopao-ce"]
|
||||
|
@ -0,0 +1,61 @@
|
||||
version: '3.1'
|
||||
|
||||
services:
|
||||
db:
|
||||
image: mysql:8.0
|
||||
restart: always
|
||||
environment:
|
||||
MYSQL_DATABASE: paopao
|
||||
MYSQL_USER: paopao
|
||||
MYSQL_PASSWORD: paopao
|
||||
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
|
||||
volumes:
|
||||
- ./scripts/paopao.sql:/docker-entrypoint-initdb.d/paopao.sql
|
||||
- ./data/mysql/data:/var/lib/mysql
|
||||
ports:
|
||||
- 127.0.0.1::3306
|
||||
networks:
|
||||
- paopao-network
|
||||
|
||||
redis:
|
||||
image: redis:7.0-alpine
|
||||
restart: always
|
||||
ports:
|
||||
- 127.0.0.1::6379
|
||||
networks:
|
||||
- paopao-network
|
||||
|
||||
zinc:
|
||||
image: public.ecr.aws/prabhat/zinc:latest
|
||||
restart: always
|
||||
ports:
|
||||
- 127.0.0.1::4080
|
||||
volumes:
|
||||
- ./data/zinc/data:/data
|
||||
environment:
|
||||
ZINC_FIRST_ADMIN_USER: admin
|
||||
ZINC_FIRST_ADMIN_PASSWORD: admin
|
||||
DATA_PATH: /data
|
||||
networks:
|
||||
- paopao-network
|
||||
|
||||
backend:
|
||||
build:
|
||||
context: .
|
||||
restart: always
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
- zinc
|
||||
# modify below to reflect your custom configure
|
||||
volumes:
|
||||
- ./config.yaml.sample:/app/paopao-ce/config.yaml
|
||||
- ./data/paopao-ce/data:/app/paopao-ce/data
|
||||
ports:
|
||||
- 127.0.0.1:8008:8008
|
||||
networks:
|
||||
- paopao-network
|
||||
|
||||
networks:
|
||||
paopao-network:
|
||||
driver: bridge
|
Loading…
Reference in new issue