Skip to content

Commit

Permalink
Use the upstream dockerfile.
Browse files Browse the repository at this point in the history
  • Loading branch information
garnertb committed Dec 12, 2023
1 parent f24a346 commit e8bb11c
Showing 1 changed file with 18 additions and 34 deletions.
52 changes: 18 additions & 34 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,27 @@ FROM $IMAGE_NAME AS build

ARG NPM_TOKEN

# Make Git available for NPM and rsync in the build image
RUN apk add --update git && rm -rf /var/cache/apk/*
RUN tdnf -y update --quiet

# We used to also make Git available for NPM and rsync in build
# tdnf clean all --quiet && \
# tdnf -y install ca-certificates git --quiet && \

WORKDIR /build
COPY package.json .
COPY package-lock.json .

# Only if needed, copy .npmrc files into the container
# COPY Dockerfile.npmrc /build/.npmrc

# If you are doing local development and OK with your private tokens in the contains (CAREFUL):
# DO NOT RECOMMEND:
# COPY .npmrc /build/.npmrc

# RUN npm install --production --verbose && mv node_modules production_node_modules
RUN npm install --production && mv node_modules production_node_modules

COPY . .

# Only if needed, copy .npmrc files into the container, again...
# COPY Dockerfile.npmrc /build/.npmrc
# Only if needed, copy file with NPM_TOKEN arg
# COPY .npmrc.arg /build/.npmrc

# Dev dependencies
# RUN npm install --verbose && rm -rf .npmrc
RUN npm install && rm -rf .npmrc

# TypeScript build
# RUN npm install --ignore-scripts --production --verbose
RUN npm ci
RUN npm run-script build
RUN mv node_modules production_node_modules
RUN rm -f .npmrc

# The open source project build needs: build the site assets sub-project
RUN cd default-assets-package && npm install && npm run build
RUN cd default-assets-package && npm ci && npm run build

FROM $IMAGE_NAME AS run

Expand All @@ -57,24 +42,23 @@ EXPOSE 3000

WORKDIR /usr/src/repos

RUN addgroup oss && adduser -D -G oss oss && chown -R oss:oss .

# Production Node.js modules
COPY --from=build --chown=oss:oss /build/production_node_modules ./node_modules
COPY --from=build /build/production_node_modules ./node_modules

# People not using painless config may need
COPY --from=build --chown=oss:oss /build/data ./data
COPY --from=build /build/data ./data

# Copy built assets, app, config map
COPY --from=build --chown=oss:oss /build/dist ./
COPY --from=build /build/dist ./

# The open source project build needs: default assets should be placed
COPY --from=build --chown=oss:oss /build/default-assets-package ./default-assets-package
COPY --from=build /build/default-assets-package ./default-assets-package

COPY --from=build /build/config ./config
COPY --from=build /build/views ./views
COPY --from=build /build/package.json ./package.json

COPY --from=build --chown=oss:oss /build/config ./config
COPY --from=build --chown=oss:oss /build/views ./views
COPY --from=build --chown=oss:oss /build/package.json ./package.json
# Only if needed, copy our environment
# COPY --from=build /build/.environment ./.environment

# Host the app
USER oss
ENTRYPOINT ["npm", "run-script", "start-in-container"]
ENTRYPOINT ["npm", "run-script", "start-in-container"]

0 comments on commit e8bb11c

Please sign in to comment.