Skip to content
Snippets Groups Projects
Commit 1cc2065b authored by Tadeusz Miesiąc's avatar Tadeusz Miesiąc
Browse files

chore(docker setup and ci): docker setup nad ci

parent 6932a435
No related branches found
No related tags found
2 merge requests!223reset the pin numbers before search results are fetch (so the results will be...,!3Development
Pipeline #78348 failed
......@@ -16,41 +16,13 @@
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
stages: # List of stages for jobs, and their order of execution
- lint
- build
stages:
- prerequisite
- test
- build
- deploy
lint:commit:
stage: lint
script:
- npm install
- echo "${CI_COMMIT_MESSAGE}" | npx commitlint
build-job: # This job runs in the build stage, which runs first.
stage: build
script:
- echo "Compiling the code..."
- echo "Compile complete."
unit-test-job: # This job runs in the test stage.
stage: test # It only starts when the job in the build stage completes successfully.
script:
- echo "Running unit tests... This will take about 60 seconds."
- sleep 60
- echo "Code coverage is 90%"
lint-test-job: # This job also runs in the test stage.
stage: test # It can run at the same time as unit-test-job (in parallel).
script:
- echo "Linting code... This will take about 10 seconds."
- sleep 10
- echo "No lint issues found."
deploy-job: # This job runs in the deploy stage.
stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
environment: production
script:
- echo "Deploying application..."
- echo "Application successfully deployed."
cache:
paths:
- ~/.cache
variables:
DOCKER_DRIVER: overlay2
.nvmrc 0 → 100644
16
\ No newline at end of file
# ---- Base Node ----
FROM node:16.17.0-alpine AS base
# install node
RUN apk add --no-cache nodejs-current npm tini yarn
# set working directory
WORKDIR /code
# Set tini as entrypoint
ENTRYPOINT ["/sbin/tini", "--"]
# copy project file
COPY package.json package-lock.json yarn.lock next.config.js ./
#
# ---- Dependencies ----
FROM base AS dependencies
# install git
RUN apk add --no-cache git
# install node packages
RUN npm install --only=production
# copy production node_modules aside
RUN cp -R node_modules prod_node_modules
# install ALL node_modules, including 'devDependencies'
RUN npm install
#
# ---- Builder ----
FROM base AS builder
# copy production node_modules
COPY --from=dependencies /code/node_modules ./node_modules
# copy app sources
COPY . .
# build app
RUN npm build
# ---- Release ----
FROM base AS release
# expose port and define CMD
EXPOSE 5000
# copy production node_modules
COPY --from=dependencies /code/prod_node_modules ./node_modules
# copy build files
COPY --from=builder /code/static ./static
COPY --from=builder /code/assets ./assets
COPY --from=builder /code/.next ./.next
CMD yarn run start -H 0.0.0.0 -p 5000
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment