Skip to content

Instantly share code, notes, and snippets.

@ben196888
Last active October 13, 2022 13:40
Show Gist options
  • Save ben196888/bedc993ce66ff167829f05a03eb27bf0 to your computer and use it in GitHub Desktop.
Save ben196888/bedc993ce66ff167829f05a03eb27bf0 to your computer and use it in GitHub Desktop.

Abu learning plan

Client side project deployment

CI

Lint + Unit test on Gitlab

CD

Deployment trigger from Gitlab

Concerns

  • docker deployment from legacy code current design merge request -> main branch -> release build -> gcp

  • dockerfile build process unclear [x] build the image

FROM node:14 AS builder

WORKDIR /app
ADD package.json ./
ADD yarn.lock ./
RUN yarn --production
COPY . /app

RUN yarn build

FROM nginx:stable
COPY --from builder /app/dist /www/root
ENV HTTP_PORT=80
ENV HTTPS_PORT=8080
FROM node:14

WORKDIR /app
ADD package.json ./
ADD yarn.lock ./
RUN yarn --production
COPY . /app

RUN yarn build
CMD yarn start
FROM node:14

WORKDIR /app
ADD package.json ./
ADD yarn.lock ./
RUN yarn --production
COPY . /app

RUN yarn build
CMD yarn e2e-test
FROM node:14

WORKDIR /app
ADD package.json ./
ADD yarn.lock ./
RUN yarn
COPY . /app

VOLUME /app/test-report/
CMD yarn test --report /app/test-report
FROM node:14

WORKDIR /app
ADD package.json ./
ADD yarn.lock ./
RUN yarn
COPY . /app

VOLUME /app/lint-report/
CMD yarn lint
FROM node:14 -> git commit

WORKDIR /app -> git commit
ADD package.json ./ -> git commit
ADD yarn.lock ./ -> git commit
RUN yarn -> git commit
COPY . /app -> git commit

# BASE IMAGE and push to registry
# 1. build image from l62-68
# 2. push image layers to registry
# pull base image
FROM BASEIMG
RUN yarn build
CMD yarn start

FROM BASEIMG
CMD yarn lint

FROM BASEIMG
CMD yarn test

docker run -f dockerfile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment