Updated Dockerfile and workflow as it was not including the secret.
All checks were successful
Docker Build & Publish / Build Docker (push) Successful in 1m7s

This commit is contained in:
ChrQR 2024-05-18 00:10:24 +02:00
parent 968a3c8d68
commit 1f7ae66339
2 changed files with 10 additions and 19 deletions

View File

@ -17,6 +17,9 @@ jobs:
node-version: 20
- name: Set up Docker Buildx 🚀
uses: docker/setup-buildx-action@v3
with:
install: true
version: latest
- name: Login to rannes.dev registry 🚢
uses: docker/login-action@v3
@ -31,7 +34,6 @@ jobs:
context: .
file: ./Dockerfile
push: true
tags: |
gitea.rannes.dev/rannes.dev/local-weather:latest
tags: gitea.rannes.dev/rannes.dev/local-weather:latest
secrets: |
"places_api=${{ secrets.PLACES_API }}"

View File

@ -1,11 +1,14 @@
# syntax=docker/dockerfile:1.3
FROM node:18-alpine AS base
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Mount environment variables
RUN --mount=type=secret,id=places_api \
cat /run/secrets/places_api
# Debug: List files in current directory
RUN ls -la
@ -18,18 +21,12 @@ RUN \
else echo "Lockfile not found." && exit 1; \
fi
# Rebuild the source code only when needed
FROM base 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
RUN \
if [ -f yarn.lock ]; then yarn run build; \
elif [ -f package-lock.json ]; then npm run build; \
@ -42,8 +39,6 @@ FROM base 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 --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
@ -54,19 +49,13 @@ COPY --from=builder /app/public ./public
RUN mkdir .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/static ./.next/static
USER nextjs
EXPOSE 3000
ENV PORT 3000
# set hostname to localhost
ENV HOSTNAME "0.0.0.0"
# server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
CMD ["node", "server.js"]