Updated Dockerfile and workflow as it was not including the secret.
All checks were successful
Docker Build & Publish / Build Docker (push) Successful in 1m7s
All checks were successful
Docker Build & Publish / Build Docker (push) Successful in 1m7s
This commit is contained in:
parent
968a3c8d68
commit
1f7ae66339
@ -17,13 +17,16 @@ jobs:
|
|||||||
node-version: 20
|
node-version: 20
|
||||||
- name: Set up Docker Buildx 🚀
|
- name: Set up Docker Buildx 🚀
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
install: true
|
||||||
|
version: latest
|
||||||
|
|
||||||
- name: Login to rannes.dev registry 🚢
|
- name: Login to rannes.dev registry 🚢
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: gitea.rannes.dev
|
registry: gitea.rannes.dev
|
||||||
username: ${{ secrets.REGISTRY_USERNAME}}
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
password: ${{ secrets.RANNES_REGISTRY}}
|
password: ${{ secrets.RANNES_REGISTRY }}
|
||||||
|
|
||||||
- name: Build and push 🏗️
|
- name: Build and push 🏗️
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
@ -31,7 +34,6 @@ jobs:
|
|||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: gitea.rannes.dev/rannes.dev/local-weather:latest
|
||||||
gitea.rannes.dev/rannes.dev/local-weather:latest
|
|
||||||
secrets: |
|
secrets: |
|
||||||
"places_api=${{ secrets.PLACES_API }}"
|
"places_api=${{ secrets.PLACES_API }}"
|
||||||
|
19
Dockerfile
19
Dockerfile
@ -1,11 +1,14 @@
|
|||||||
|
# syntax=docker/dockerfile:1.3
|
||||||
FROM node:18-alpine AS base
|
FROM node:18-alpine AS base
|
||||||
|
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
RUN apk add --no-cache libc6-compat
|
RUN apk add --no-cache libc6-compat
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Mount environment variables
|
# Mount environment variables
|
||||||
RUN --mount=type=secret,id=places_api \
|
RUN --mount=type=secret,id=places_api \
|
||||||
cat /run/secrets/places_api
|
cat /run/secrets/places_api
|
||||||
|
|
||||||
# Debug: List files in current directory
|
# Debug: List files in current directory
|
||||||
RUN ls -la
|
RUN ls -la
|
||||||
|
|
||||||
@ -18,18 +21,12 @@ RUN \
|
|||||||
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 base AS builder
|
FROM base 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
|
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
if [ -f yarn.lock ]; then yarn run build; \
|
if [ -f yarn.lock ]; then yarn run build; \
|
||||||
elif [ -f package-lock.json ]; then npm run build; \
|
elif [ -f package-lock.json ]; then npm run build; \
|
||||||
@ -42,8 +39,6 @@ FROM base 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
|
|
||||||
|
|
||||||
RUN addgroup --system --gid 1001 nodejs
|
RUN addgroup --system --gid 1001 nodejs
|
||||||
RUN adduser --system --uid 1001 nextjs
|
RUN adduser --system --uid 1001 nextjs
|
||||||
@ -54,19 +49,13 @@ COPY --from=builder /app/public ./public
|
|||||||
RUN mkdir .next
|
RUN mkdir .next
|
||||||
RUN chown nextjs:nodejs .next
|
RUN chown nextjs:nodejs .next
|
||||||
|
|
||||||
# Automatically leverage output traces to reduce image size
|
|
||||||
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||||
|
|
||||||
USER nextjs
|
USER nextjs
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
ENV PORT 3000
|
ENV PORT 3000
|
||||||
# set hostname to localhost
|
|
||||||
ENV HOSTNAME "0.0.0.0"
|
ENV HOSTNAME "0.0.0.0"
|
||||||
|
|
||||||
# server.js is created by next build from the standalone output
|
CMD ["node", "server.js"]
|
||||||
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
|
|
||||||
CMD ["node", "server.js"]
|
|
||||||
|
Loading…
Reference in New Issue
Block a user