Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Gateway frontend dockerfile #2122

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/manual-deploy-ten-gateway-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:
- name: "Build and Push Docker Image"
run: |
DOCKER_BUILDKIT=1 docker build \
--build-arg NEXT_PUBLIC_API_HOST_ENVIRONMENT="${{ github.event.inputs.testnet_type }}"" \
--build-arg NEXT_PUBLIC_API_HOST_ENVIRONMENT="${{ github.event.inputs.testnet_type }}" \
--build-arg NEXT_PUBLIC_NETWORK_NAME="${{ env.NETWORK_NAME }}" \
--build-arg NEXT_PUBLIC_TENSCAN_URL="${{ env.TENSCAN_URL }}" \
--build-arg NEXT_PUBLIC_GATEWAY_URL="${{ env.GATEWAY_URL }}" \
Expand Down
11 changes: 7 additions & 4 deletions tools/walletextension/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Use an official Node.js LTS version as a base image
FROM node:20-alpine AS base

# Install pnpm
RUN npm install -g pnpm


ARG NEXT_PUBLIC_NETWORK_NAME
ARG NEXT_PUBLIC_TENSCAN_URL
ARG NEXT_PUBLIC_GATEWAY_URL
Expand All @@ -21,25 +21,28 @@ WORKDIR /usr/src/app
COPY tools/walletextension/frontend/ .

# Install dependencies
RUN pnpm ci
RUN pnpm install --frozen-lockfile

# Build the Next.js app
RUN pnpm run build

# Reduce the size of the final image by using a lighter base image
FROM node:20-alpine AS runner

# Install pnpm
RUN npm install -g pnpm
Copy link
Contributor

@badgersrus badgersrus Nov 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one is redundant since its installed at the start? Not sure if that --prod flag works the same with pnpm at the latter stage but maybe @pbienek might know more

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a different image (base and runner image) and it needs pnpm installed.
As far as I know --prod flag doesn't install dev dependencies which makes runner image smaller.


# Set the working directory
WORKDIR /usr/src/app

# Copy only the necessary files from the build stage
COPY --from=base /usr/src/app/.next ./.next
COPY --from=base /usr/src/app/public ./public
COPY --from=base /usr/src/app/package*.json ./
COPY --from=base /usr/src/app/pnpm-lock.yaml ./

# Install production dependencies
RUN pnpm ci --production

RUN pnpm install --prod --frozen-lockfile

# Set the environment variables
ENV PORT=80
Expand Down
Loading