Update 2 files
- /.gitlab-ci.yml - /Dockerfile
This commit is contained in:
parent
5fc41db285
commit
1665d9a0ee
@ -3,15 +3,14 @@ publish:
|
||||
stage: build
|
||||
variables:
|
||||
DOCKER_DRIVER: overlay
|
||||
|
||||
services:
|
||||
- docker:dind
|
||||
before_script:
|
||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
||||
script:
|
||||
- echo "hi"
|
||||
#- docker build --pull -t "$CI_REGISTRY_IMAGE" .
|
||||
#- docker push "$CI_REGISTRY_IMAGE"
|
||||
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
|
||||
- docker push "$CI_REGISTRY_IMAGE"
|
||||
only:
|
||||
- main
|
||||
|
||||
@ -19,11 +18,10 @@ deploy:
|
||||
image: alpine:latest
|
||||
stage: deploy
|
||||
tags:
|
||||
# - deployment
|
||||
script:
|
||||
- chmod og= $ID_RSA
|
||||
- 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:
|
||||
name: production
|
||||
url: https://bs-overlay.fascinated.cc
|
||||
|
24
Dockerfile
24
Dockerfile
@ -1,5 +1,5 @@
|
||||
# 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.
|
||||
RUN apk add libc6-compat
|
||||
WORKDIR /app
|
||||
@ -10,35 +10,31 @@ COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
|
||||
# Copy cached files
|
||||
#COPY node_modules ./
|
||||
|
||||
RUN npm i
|
||||
#RUN npm i
|
||||
|
||||
# RUN \
|
||||
# if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
||||
# elif [ -f package-lock.json ]; then npm ci; \
|
||||
# elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
|
||||
# else echo "Lockfile not found." && exit 1; \
|
||||
# fi
|
||||
RUN \
|
||||
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
|
||||
elif [ -f package-lock.json ]; then npm ci; \
|
||||
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
|
||||
else echo "Lockfile not found." && exit 1; \
|
||||
fi
|
||||
|
||||
# Rebuild the source code only when needed
|
||||
FROM node:19-alpine AS builder
|
||||
FROM node:19 AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
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
|
||||
|
||||
# Build the project
|
||||
RUN yarn build
|
||||
|
||||
# Production image, copy all the files and run next
|
||||
FROM node:19-alpine AS runner
|
||||
FROM node:19 AS runner
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV production
|
||||
# Uncomment the following line in case you want to disable telemetry during runtime.
|
||||
ENV NEXT_TELEMETRY_DISABLED 1
|
||||
|
||||
RUN addgroup -g 1001 -S nodejs
|
||||
|
Reference in New Issue
Block a user