Skip to content

Commit

Permalink
fix: nextjs build
Browse files Browse the repository at this point in the history
  • Loading branch information
m8vago committed Mar 12, 2024
1 parent 2e4b9c9 commit dd378d9
Show file tree
Hide file tree
Showing 9 changed files with 828 additions and 80 deletions.
4 changes: 2 additions & 2 deletions golang/pkg/cli/container_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ func GetTraefik(state *State, args *ArgsFlags) containerbuilder.Builder {
cont containerbuilder.ParentContainer,
) error {
addr := fmt.Sprintf("http://%s:%d/api/status", traefikHost, state.SettingsFile.TraefikWebPort)
return healhProbe(ctx, addr)
return healthProbe(ctx, addr)
})
} else {
traefik = traefik.
Expand Down Expand Up @@ -613,7 +613,7 @@ func CopyTraefikConfiguration(ctx context.Context, name, internalHostDomain stri
return err
}

func healhProbe(ctx context.Context, address string) error {
func healthProbe(ctx context.Context, address string) error {
ctx, cancel := context.WithTimeout(ctx, healhProbeTimeout)
defer cancel()

Expand Down
3 changes: 2 additions & 1 deletion web/crux-ui/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.env*
.vscode
.vscode
Dockerfile
15 changes: 8 additions & 7 deletions web/crux-ui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ COPY ./package.json ./package-lock.json ./.npm ./
RUN npm ci --arch=x64 --platform=linuxmusl --cache .npm --prefer-offline --no-fund

COPY . .
RUN npm run build && \
npm prune --production
RUN npm run build

# stage 2, run the app
FROM docker.io/library/node:20-alpine3.17 AS RUNNER
Expand All @@ -18,20 +17,22 @@ WORKDIR /app
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
ENV TZ UTC
RUN apk --update add tzdata
RUN apk --update add tzdata && \
mkdir .next && \
chown node:node .next

COPY --from=BUILDER --chown=node:node /app/.next/standalone ./
COPY --from=BUILDER --chown=node:node /app/public ./public
COPY --from=BUILDER /app/package.json ./package.json
COPY --from=BUILDER --chown=node:node /app/.next ./.next
COPY --from=BUILDER /app/node_modules ./node_modules
COPY --from=BUILDER --chown=node:node /app/.next/static ./.next/static

USER node

EXPOSE 3000
ENV HOSTNAME "0.0.0.0"
ENV PORT 3000
LABEL org.opencontainers.image.source="https://github.com/dyrector-io/dyrectorio/web/crux-ui"

HEALTHCHECK --interval=30s --timeout=5s \
CMD wget -nv -t1 --spider http://localhost:3000/ || exit 1

ENTRYPOINT [ "npm", "run", "start:prod"]
CMD [ "node", "server.js" ]
1 change: 1 addition & 0 deletions web/crux-ui/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ module.exports = {
eslint: {
dirs: ['src', 'e2e'],
},
output: 'standalone',
}
Loading

0 comments on commit dd378d9

Please sign in to comment.