diff --git a/.gitea/workflows/pipeline.yaml b/.gitea/workflows/pipeline.yaml index 525bab4..407aa99 100644 --- a/.gitea/workflows/pipeline.yaml +++ b/.gitea/workflows/pipeline.yaml @@ -17,13 +17,16 @@ 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 with: registry: gitea.rannes.dev - username: ${{ secrets.REGISTRY_USERNAME}} - password: ${{ secrets.RANNES_REGISTRY}} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.RANNES_REGISTRY }} - name: Build and push 🏗️ uses: docker/build-push-action@v2 @@ -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 }}" diff --git a/Dockerfile b/Dockerfile index a81eda0..0312c41 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] \ No newline at end of file +CMD ["node", "server.js"]