Update 2 files
- /.gitlab-ci.yml - /Dockerfile
This commit is contained in:
parent
5fc41db285
commit
1665d9a0ee
@ -3,15 +3,14 @@ publish:
|
|||||||
stage: build
|
stage: build
|
||||||
variables:
|
variables:
|
||||||
DOCKER_DRIVER: overlay
|
DOCKER_DRIVER: overlay
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker:dind
|
- docker:dind
|
||||||
before_script:
|
before_script:
|
||||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
||||||
script:
|
script:
|
||||||
- echo "hi"
|
- echo "hi"
|
||||||
#- docker build --pull -t "$CI_REGISTRY_IMAGE" .
|
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
|
||||||
#- docker push "$CI_REGISTRY_IMAGE"
|
- docker push "$CI_REGISTRY_IMAGE"
|
||||||
only:
|
only:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
@ -19,11 +18,10 @@ deploy:
|
|||||||
image: alpine:latest
|
image: alpine:latest
|
||||||
stage: deploy
|
stage: deploy
|
||||||
tags:
|
tags:
|
||||||
# - deployment
|
|
||||||
script:
|
script:
|
||||||
- chmod og= $ID_RSA
|
- chmod og= $ID_RSA
|
||||||
- apk update && apk add openssh-client
|
- apk update && apk add openssh-client
|
||||||
- ssh -i $ID_RSA -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "cd /home/overlay && docker compose pull && docker compose up -d"
|
- ssh -i $ID_RSA -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "cd /home/overlay && docker compose pull && docker compose up -d && docker image prune -f"
|
||||||
environment:
|
environment:
|
||||||
name: production
|
name: production
|
||||||
url: https://bs-overlay.fascinated.cc
|
url: https://bs-overlay.fascinated.cc
|
||||||
|
24
Dockerfile
24
Dockerfile
@ -1,5 +1,5 @@
|
|||||||
# Install dependencies only when needed
|
# Install dependencies only when needed
|
||||||
FROM node:19-alpine AS deps
|
FROM node:19 AS deps
|
||||||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
||||||
RUN apk add libc6-compat
|
RUN apk add libc6-compat
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@ -10,35 +10,31 @@ COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
|
|||||||
# Copy cached files
|
# Copy cached files
|
||||||
#COPY node_modules ./
|
#COPY node_modules ./
|
||||||
|
|
||||||
RUN npm i
|
#RUN npm i
|
||||||
|
|
||||||
# RUN \
|
RUN \
|
||||||
# if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
||||||
# elif [ -f package-lock.json ]; then npm ci; \
|
elif [ -f package-lock.json ]; then npm ci; \
|
||||||
# elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
|
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
|
||||||
# else echo "Lockfile not found." && exit 1; \
|
else echo "Lockfile not found." && exit 1; \
|
||||||
# fi
|
fi
|
||||||
|
|
||||||
# Rebuild the source code only when needed
|
# Rebuild the source code only when needed
|
||||||
FROM node:19-alpine AS builder
|
FROM node:19 AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Next.js collects completely anonymous telemetry data about general usage.
|
|
||||||
# Learn more here: https://nextjs.org/telemetry
|
|
||||||
# Uncomment the following line in case you want to disable telemetry during the build.
|
|
||||||
ENV NEXT_TELEMETRY_DISABLED 1
|
ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
|
|
||||||
# Build the project
|
# Build the project
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|
||||||
# Production image, copy all the files and run next
|
# Production image, copy all the files and run next
|
||||||
FROM node:19-alpine AS runner
|
FROM node:19 AS runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV production
|
||||||
# Uncomment the following line in case you want to disable telemetry during runtime.
|
|
||||||
ENV NEXT_TELEMETRY_DISABLED 1
|
ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
|
|
||||||
RUN addgroup -g 1001 -S nodejs
|
RUN addgroup -g 1001 -S nodejs
|
||||||
|
Reference in New Issue
Block a user