This commit is contained in:
parent
e8d7c5777f
commit
01d56c864a
2
.github/workflows/cicd.yml
vendored
2
.github/workflows/cicd.yml
vendored
@ -26,8 +26,6 @@ jobs:
|
|||||||
password: ${{ secrets.TOKEN }}
|
password: ${{ secrets.TOKEN }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
env:
|
|
||||||
SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
|
24
Dockerfile
24
Dockerfile
@ -1,7 +1,7 @@
|
|||||||
# Install dependencies only when needed
|
# Install dependencies only when needed
|
||||||
FROM node:19-alpine AS deps
|
FROM node:19-alpine AS deps
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR leCoffre-front
|
||||||
|
|
||||||
COPY package.json ./
|
COPY package.json ./
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ RUN apk update && apk add openssh-client git
|
|||||||
|
|
||||||
ARG SSH_PRIVATE_KEY
|
ARG SSH_PRIVATE_KEY
|
||||||
RUN mkdir -p /root/.ssh && \
|
RUN mkdir -p /root/.ssh && \
|
||||||
echo "${SSH_PRIVATE_KEY}" | base64 -d > /root/.ssh/id_rsa && \
|
echo "${SSH_PRIVATE_KEY}" > /root/.ssh/id_rsa && \
|
||||||
chmod 600 /root/.ssh/id_rsa && \
|
chmod 600 /root/.ssh/id_rsa && \
|
||||||
eval "$(ssh-agent -s)" && \
|
eval "$(ssh-agent -s)" && \
|
||||||
ssh-add /root/.ssh/id_rsa && \
|
ssh-add /root/.ssh/id_rsa && \
|
||||||
@ -23,11 +23,11 @@ RUN npm install --frozen-lockfile
|
|||||||
# Rebuild the source code only when needed
|
# Rebuild the source code only when needed
|
||||||
FROM node:19-alpine AS builder
|
FROM node:19-alpine AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR leCoffre-front
|
||||||
|
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps leCoffre-front/node_modules ./node_modules
|
||||||
COPY --from=deps /app/package.json package.json
|
COPY --from=deps leCoffre-front/package.json package.json
|
||||||
COPY --from=deps /app/.env ./.env
|
COPY --from=deps leCoffre-front/.env ./.env
|
||||||
COPY tsconfig.json tsconfig.json
|
COPY tsconfig.json tsconfig.json
|
||||||
COPY next.config.js next.config.js
|
COPY next.config.js next.config.js
|
||||||
COPY src src
|
COPY src src
|
||||||
@ -37,16 +37,16 @@ RUN npm run build
|
|||||||
# Production image, copy all the files and run next
|
# Production image, copy all the files and run next
|
||||||
FROM node:19-alpine AS production
|
FROM node:19-alpine AS production
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR leCoffre-front
|
||||||
|
|
||||||
RUN adduser -D lecoffreuser --uid 10000 && chown -R lecoffreuser .
|
RUN adduser -D lecoffreuser --uid 10000 && chown -R lecoffreuser .
|
||||||
|
|
||||||
COPY public ./public
|
COPY public ./public
|
||||||
COPY --from=builder --chown=lecoffreuser /app/node_modules ./node_modules
|
COPY --from=builder --chown=lecoffreuser leCoffre-front/node_modules ./node_modules
|
||||||
COPY --from=builder --chown=lecoffreuser /app/.next ./.next
|
COPY --from=builder --chown=lecoffreuser leCoffre-front/.next ./.next
|
||||||
COPY --from=builder --chown=lecoffreuser /app/next.config.js ./next.config.js
|
COPY --from=builder --chown=lecoffreuser leCoffre-front/next.config.js ./next.config.js
|
||||||
COPY --from=builder --chown=lecoffreuser /app/package.json ./package.json
|
COPY --from=builder --chown=lecoffreuser leCoffre-front/package.json ./package.json
|
||||||
COPY --from=builder --chown=lecoffreuser /app/.env ./.env
|
COPY --from=builder --chown=lecoffreuser leCoffre-front/.env ./.env
|
||||||
|
|
||||||
USER lecoffreuser
|
USER lecoffreuser
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user