generated from uc-cdis/commons-frontend-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
23 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,31 @@ | ||
# docker build -t gen3ff . | ||
# docker run -p 3000:3000 -it gen3ff | ||
# for Macbook silicon M1/m2 uncomment the following lines and comment quay.io/cdis/ubuntu:20.04: | ||
#FROM arm64v8/ubuntu:20.04 as build | ||
# Build stage | ||
FROM node:20-slim AS builder | ||
|
||
FROM quay.io/cdis/ubuntu:20.04 AS build | ||
WORKDIR /gen3 | ||
|
||
ARG NODE_VERSION=20 | ||
COPY ./package.json ./package-lock.json ./next.config.js ./tsconfig.json ./.env.development ./tailwind.config.js ./postcss.config.js ./start.sh ./ | ||
RUN npm ci | ||
COPY ./src ./src | ||
COPY ./public ./public | ||
COPY ./config ./config | ||
RUN npm install @swc/core @napi-rs/magic-string && \ | ||
npm run build | ||
|
||
ARG BASE_PATH | ||
ARG NEXT_PUBLIC_PORTAL_BASENAME | ||
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global | ||
ENV PATH=$PATH:/home/node/.npm-global/bin | ||
# Production stage | ||
FROM node:20-slim AS runner | ||
|
||
WORKDIR /gen3 | ||
ENV PORT=3000 | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
libssl1.1 \ | ||
libgnutls30 \ | ||
ca-certificates \ | ||
curl \ | ||
git \ | ||
gnupg \ | ||
&& mkdir -p /etc/apt/keyrings \ | ||
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ | ||
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \ | ||
&& apt-get update \ | ||
&& apt-get install -y nodejs \ | ||
&& apt-get clean \ | ||
&& npm install -g npm@10.5.2 | ||
RUN addgroup --system --gid 1001 nextjs && \ | ||
adduser --system --uid 1001 nextjs | ||
|
||
RUN addgroup --system --gid 1001 nextjs && adduser --system --uid 1001 nextjs | ||
COPY ./package.json ./package-lock.json ./ | ||
COPY ./package-lock.json ./ | ||
COPY ./src ./src | ||
COPY ./public ./public | ||
COPY ./config ./config | ||
COPY ./next.config.js ./ | ||
COPY ./tsconfig.json ./ | ||
COPY ./.env.development ./ | ||
COPY ./.env.production ./ | ||
COPY ./tailwind.config.js ./ | ||
COPY ./postcss.config.js ./ | ||
RUN npm ci | ||
RUN npm install \ | ||
"@swc/core" \ | ||
"@napi-rs/magic-string" | ||
RUN npm run build | ||
ENV PORT=80 | ||
COPY --from=builder /gen3/node_modules ./node_modules | ||
COPY --from=builder /gen3/config ./config | ||
COPY --from=builder /gen3/public ./public | ||
COPY --from=builder --chown=nextjs:nextjs /gen3/.next ./.next | ||
COPY --from=builder /gen3/start.sh /gen3/package.json ./ | ||
|
||
USER nextjs | ||
ENV PORT=3000 | ||
CMD bash ./start.sh | ||
Check warning on line 31 in Dockerfile
|