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 04342ec
Showing 10 changed files with 869 additions and 73 deletions.
4 changes: 2 additions & 2 deletions golang/pkg/cli/container_defaults.go
Original file line number Diff line number Diff line change
@@ -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.
@@ -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()

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
21 changes: 11 additions & 10 deletions web/crux-ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -4,12 +4,11 @@ WORKDIR /app

ENV NEXT_TELEMETRY_DISABLED 1

COPY ./package.json ./package-lock.json ./.npm ./
RUN npm ci --arch=x64 --platform=linuxmusl --cache .npm --prefer-offline --no-fund
COPY ./package.json ./package-lock.json ./
RUN npm ci --arch=x64 --platform=linuxmusl

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
@@ -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/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/standalone ./
COPY --from=BUILDER --chown=node:node /app/.next/static ./.next/static
COPY --from=BUILDER --chown=node:node /app/crux-ui-entrypoint.sh ./crux-ui-entrypoint.sh

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"]
ENTRYPOINT [ "/app/crux-ui-entrypoint.sh" ]
3 changes: 3 additions & 0 deletions web/crux-ui/crux-ui-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

exec 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
@@ -14,4 +14,5 @@ module.exports = {
eslint: {
dirs: ['src', 'e2e'],
},
output: 'standalone',
}
Loading

0 comments on commit 04342ec

Please sign in to comment.