Skip to content

Commit

Permalink
Merge pull request #271 from City-of-Helsinki/dev
Browse files Browse the repository at this point in the history
Dev to main
  • Loading branch information
rpnykanen authored Sep 17, 2024
2 parents 65f7f0a + a6c3b3b commit 0234d75
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 63 deletions.
27 changes: 16 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# =======================================
FROM node:16-alpine AS deps
FROM registry.access.redhat.com/ubi8/nodejs-16 AS deps
# =======================================

# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
# USER node:0
RUN apk add --no-cache libc6-compat
USER root
RUN yum install -y glibc-langpack-en curl --setopt=tsflags=nodocs && \
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo && \
yum -y install yarn --setopt=tsflags=nodocs && \
yum clean all
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile

# =======================================
FROM node:16-alpine AS builder
FROM registry.access.redhat.com/ubi8/nodejs-16 AS builder
# =======================================
# USER node:0
ARG NEXT_PUBLIC_DRUPAL_BASE_URL
Expand Down Expand Up @@ -50,6 +52,10 @@ WORKDIR /app
COPY . .
COPY --from=deps /app/node_modules ./node_modules

# install yarn
USER root
RUN curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo
RUN yum -y install yarn

RUN yarn build
# Prune dev & build deps until we can use Yarn 2 which does it on the next line
Expand All @@ -58,16 +64,13 @@ RUN rm -rf node_modules
RUN yarn install --production --ignore-scripts --prefer-offline

# =======================================
FROM node:16-alpine AS runner
FROM registry.access.redhat.com/ubi8/nodejs-16 AS runner
# =======================================

WORKDIR /app
# USER node:0
ENV NODE_ENV production
ENV CACHE_REPOPULATE '1'
#DEBUG add curl to container for network debugging purposes
RUN apk --no-cache add curl


COPY --from=builder /app/.next ./.next
COPY --from=builder /app/next.config.js ./next.config.js
Expand All @@ -82,12 +85,14 @@ COPY --from=builder /app/logs ./logs
# copy .env.production to runner so that runtime can have new env vars from repo if needed
#COPY --from=builder /app/.env.production .env.production


# node process user should be able to write to .next/*
USER root
RUN curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo
RUN yum -y install yarn

RUN chmod -R a+rwx ./.next
RUN chmod -R a+rwx ./logs


EXPOSE 8080
ENV PORT=8080

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
# Continuous integration (CI) triggers cause a pipeline to run whenever you push
# an update to the specified branches or you push specified tags.
trigger:
batch: true
branches:
include:
- main
paths:
exclude:
- README.md
trigger: none

# Pull request (PR) triggers cause a pipeline to run whenever a pull request is
# opened with one of the specified target branches, or when updates are made to
Expand All @@ -23,13 +16,6 @@ pr: none
# By default, use self-hosted agents
pool: Default

# Image tag name for Fuse projects
#parameters:
#- name: imagetag
# displayName: Image tag to be built and/or deployed
# type: string
# default: latest

resources:
repositories:
# Azure DevOps repository
Expand All @@ -39,9 +25,13 @@ resources:
name: infofinland/infofinland-pipelines

extends:
# Filename in Azure DevOps Repository (note possible -ui or -api)
# Django example: azure-pipelines-PROJECTNAME-api-release.yml
# Drupal example: azure-pipelines-drupal-release.yml
template: azure-pipelines-infofinland-ui-stageprod.yml@infofinland-pipelines
#parameters:
#imagetag: ${{ parameters.imagetag }}
# Filename in Azure DevOps Repository
template: components/infofinland-ui/pipelines/infofinland-ui-production.yml@infofinland-pipelines
# parameters:
# Application build arguments and config map values as key value pairs.
# Does not contain all buildArguments or configMap values, the rest located in infofinland-pipelines
# The values here will override the values defined in the infofinland-pipelines repository
# buildArgs:
# DEBUG: 1
# configMap: # pod environment variables
# DEBUG: 1
31 changes: 15 additions & 16 deletions azure-pipelines-test.yml → pipelines/infofinland-ui-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ trigger:
batch: true
branches:
include:
- dev
- main
paths:
exclude:
- README.md
- '*.md'
- '.github/'
- 'pipelines/infofinland-ui-production.yml'
- 'pipelines/infofinland-ui-test.yml'

# Pull request (PR) triggers cause a pipeline to run whenever a pull request is
# opened with one of the specified target branches, or when updates are made to
Expand All @@ -23,13 +26,6 @@ pr: none
# By default, use self-hosted agents
pool: Default

# Image tag name for Fuse projects
#parameters:
#- name: imagetag
# displayName: Image tag to be built and/or deployed
# type: string
# default: latest

resources:
repositories:
# Azure DevOps repository
Expand All @@ -39,10 +35,13 @@ resources:
name: infofinland/infofinland-pipelines

extends:
# Filename in Azure DevOps Repository (note possible -ui or -api)
# Django example: azure-pipelines-PROJECTNAME-api-master.yml
# Drupal example: azure-pipelines-drupal-master.yml
template: azure-pipelines-infofinland-ui-test.yml@infofinland-pipelines
# Image tag name for Fuse projects
#parameters:
#imagetag: ${{ parameters.imagetag }}
# Filename in Azure DevOps Repository
template: components/infofinland-ui/pipelines/infofinland-ui-staging.yml@infofinland-pipelines
# parameters:
# Application build arguments and config map values as key value pairs.
# Does not contain all buildArguments or configMap values, the rest located in infofinland-pipelines
# The values here will override the values defined in the infofinland-pipelines repository
# buildArgs:
# DEBUG: 1
# configMap: # pod environment variables
# DEBUG: 1
29 changes: 14 additions & 15 deletions azure-pipelines-devtest.yml → pipelines/infofinland-ui-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ trigger:
- dev
paths:
exclude:
- README.md
- '*.md'
- '.github/'
- 'pipelines/infofinland-ui-production.yml'
- 'pipelines/infofinland-ui-staging.yml'

# Pull request (PR) triggers cause a pipeline to run whenever a pull request is
# opened with one of the specified target branches, or when updates are made to
Expand All @@ -23,13 +26,6 @@ pr: none
# By default, use self-hosted agents
pool: Default

# Image tag name for Fuse projects
#parameters:
#- name: imagetag
# displayName: Image tag to be built and/or deployed
# type: string
# default: latest

resources:
repositories:
# Azure DevOps repository
Expand All @@ -39,10 +35,13 @@ resources:
name: infofinland/infofinland-pipelines

extends:
# Filename in Azure DevOps Repository (note possible -ui or -api)
# Django example: azure-pipelines-PROJECTNAME-api-master.yml
# Drupal example: azure-pipelines-drupal-master.yml
template: azure-pipelines-infofinland-ui-devtest.yml@infofinland-pipelines
# Image tag name for Fuse projects
#parameters:
#imagetag: ${{ parameters.imagetag }}
# Filename in Azure DevOps Repository
template: components/infofinland-ui/pipelines/infofinland-ui-test.yml@infofinland-pipelines
# parameters:
# Application build arguments and config map values as key value pairs.
# Does not contain all buildArguments or configMap values, the rest located in infofinland-pipelines
# The values here will override the values defined in the infofinland-pipelines repository
# buildArgs:
# DEBUG: 1
# configMap: # pod environment variables
# DEBUG: 1

0 comments on commit 0234d75

Please sign in to comment.