From e78c22be7f25809e4f7a6590e46bb773eac85a6f Mon Sep 17 00:00:00 2001 From: RenChu Date: Tue, 7 Jun 2022 00:15:50 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=AE=20Added=20docker-compose=20so=20th?= =?UTF-8?q?at=20it=20could=20be=20deployed=20in=20one=20command.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Todo: For now, this docker-compose config assumes mysql and zinc are running in the environment. Will consider moving them to containers. --- Dockerfile | 1 + docker-compose.yaml | 12 ++++++++++++ web/Dockerfile | 14 ++++++++++---- 3 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 docker-compose.yaml diff --git a/Dockerfile b/Dockerfile index 109cbea6..3dcf8877 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ 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 +COPY config.yaml . EXPOSE 8000 diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 00000000..fd3c261c --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,12 @@ +version: "3" +services: + backend: + build: + context: . + expose: + - 3306 + - 4080 + + frontend: + build: + context: web diff --git a/web/Dockerfile b/web/Dockerfile index 0f32757a..3a703661 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -1,9 +1,15 @@ -FROM library/nginx +FROM node as node -USER root +WORKDIR /work/ +COPY . . + +RUN yarn +RUN yarn build + +FROM nginx as nginx # copy static files -COPY ./dist/ /usr/share/nginx/html/ +COPY --from=node /work/dist/ /usr/share/nginx/html/ # HEALTHCHECK -HEALTHCHECK --interval=5s --timeout=3s --retries=3 CMD service nginx status | grep running || exit 1 \ No newline at end of file +HEALTHCHECK --interval=5s --timeout=3s --retries=3 CMD service nginx status | grep running || exit 1