From 593e2181f246a825e07934827e22387e237881a4 Mon Sep 17 00:00:00 2001 From: Stepan Usatiuk Date: Sun, 15 Jan 2023 13:11:25 +0100 Subject: [PATCH] docker frontend cache doesn't depend on backend --- .circleci/config.yml | 2 +- Dockerfile | 3 ++- frontend/src/redux/photos/sagas.ts | 2 +- src/routes/photos.ts | 2 +- src/routes/users.ts | 2 +- src/{ => shared}/types.ts | 0 6 files changed, 6 insertions(+), 5 deletions(-) rename src/{ => shared}/types.ts (100%) diff --git a/.circleci/config.yml b/.circleci/config.yml index b599667..a6a286f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -112,7 +112,7 @@ jobs: - run: name: build and push to docker hub - command: docker buildx build --push --platform linux/arm64,linux/amd64 --tag stepanusatiuk/photos:$CIRCLE_BRANCH . + command: docker buildx build --progress=plain --push --platform linux/arm64,linux/amd64 --tag stepanusatiuk/photos:$CIRCLE_BRANCH . #command: docker buildx build --push --platform linux/amd64 --tag stepanusatiuk/photos:$CIRCLE_BRANCH . # build-arm: diff --git a/Dockerfile b/Dockerfile index 498e5c9..c368f04 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,8 @@ FROM node:16-bullseye as frontbuild WORKDIR /usr/src/app/frontend COPY ./frontend/package*.json ./ RUN npm ci --only=production -COPY ./ ../ +COPY ./frontend . +COPY ./src/shared ../src/shared RUN npm run build && bash -O extglob -c 'rm -rfv !("dist")' WORKDIR ../ RUN bash -O extglob -c 'rm -rfv !("frontend")' diff --git a/frontend/src/redux/photos/sagas.ts b/frontend/src/redux/photos/sagas.ts index 4b632a8..6a4ee04 100644 --- a/frontend/src/redux/photos/sagas.ts +++ b/frontend/src/redux/photos/sagas.ts @@ -42,7 +42,7 @@ import { photoUploadSuccess, } from "./actions"; import { IPhotosNewRespBody } from "../../../../src/routes/photos"; -import { IPhotosListPagination } from "../../../../src/types"; +import { IPhotosListPagination } from "../../../../src/shared/types"; // Thanks, https://dev.to/qortex/compute-md5-checksum-for-a-file-in-typescript-59a4 function computeChecksumMd5(file: File): Promise { diff --git a/src/routes/photos.ts b/src/routes/photos.ts index 9ca3172..04525e0 100644 --- a/src/routes/photos.ts +++ b/src/routes/photos.ts @@ -1,7 +1,7 @@ import * as Router from "@koa/router"; import { IPhotoReqJSON, Photo } from "~entity/Photo"; import { User } from "~entity/User"; -import { IAPIResponse, IPhotosListPagination } from "~types"; +import { IAPIResponse, IPhotosListPagination } from "~/shared/types"; import * as fs from "fs/promises"; import send = require("koa-send"); import { getHash, getSize } from "~util"; diff --git a/src/routes/users.ts b/src/routes/users.ts index 34b5a20..329df42 100644 --- a/src/routes/users.ts +++ b/src/routes/users.ts @@ -1,7 +1,7 @@ import * as Router from "@koa/router"; import { getConfigValue, ConfigKey } from "~entity/Config"; import { IUserAuthJSON, IUserJWT, User } from "~entity/User"; -import { IAPIResponse } from "~types"; +import { IAPIResponse } from "~/shared/types"; export const userRouter = new Router(); diff --git a/src/types.ts b/src/shared/types.ts similarity index 100% rename from src/types.ts rename to src/shared/types.ts