Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(storage-server): docker build process #439

Merged
merged 8 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/container/nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ FROM ghcr.io/alimd/nginx:1

```Dockerfile
ARG NODE_VERSION=lts
FROM node:${NODE_VERSION} as build-deps
FROM docker.io/library/node:${NODE_VERSION} as build-deps
WORKDIR /app
COPY package.json *.lock ./
RUN yarn install --frozen-lockfile --non-interactive && yarn cache clean
Expand Down
5 changes: 5 additions & 0 deletions packages/service/storage-server/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!src/
!package.json
!tsconfig.json
!*.lock
21 changes: 14 additions & 7 deletions packages/service/storage-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
ARG NODE_VERSION=lts
FROM node:${NODE_VERSION} as build
FROM docker.io/library/node:${NODE_VERSION} as build

WORKDIR /app

COPY package.json *.lock ./
RUN yarn install --frozen-lockfile --non-interactive && yarn cache clean
RUN if [ -f *.lock ]; then \
yarn install --frozen-lockfile --non-interactive; \
else \
yarn install --non-interactive; \
fi;

COPY . .
RUN yarn build

ARG DIST=dist
RUN ls -lahF ${DIST}

# ---

ARG NODE_VERSION=lts
FROM node:${NODE_VERSION}
FROM docker.io/library/node:${NODE_VERSION}

WORKDIR /app

Expand All @@ -21,9 +27,10 @@ ENV ALWATR_DEBUG *
ENV HOST 0.0.0.0
ENV PORT 80
EXPOSE 80
CMD index.js

COPY package.json *.lock ./
COPY --from=build /app/package.json /app/yarn.lock ./
RUN yarn install --frozen-lockfile --non-interactive --production && yarn cache clean

COPY --from=build /app/dist/ .
CMD ["dist/index.js"]
ARG DIST=dist
COPY --from=build /app/${dist} .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

COPY --from=build /app/${DIST} .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?