Skip to content

Commit

Permalink
migrate docker builds to more cacheable yarn style build with nginx
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesw committed Nov 25, 2024
1 parent c621ad7 commit 7387bf6
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/bld_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,22 @@ jobs:
- artifact_name: prod
docker_name: orcid/registry/orcid-web-frontend-prod
build_args: "build_env=prod"
file: Dockerfile.build
file: Dockerfile.build.yarn

- artifact_name: sandbox
docker_name: orcid/registry/orcid-web-frontend-sandbox
build_args: "build_env=sandbox"
file: Dockerfile.build
file: Dockerfile.build.yarn

- artifact_name: qa
docker_name: orcid/registry/orcid-web-frontend-qa
build_args: "build_env=qa"
file: Dockerfile.build
file: Dockerfile.build.yarn

- artifact_name: int
docker_name: orcid/registry/orcid-web-frontend-int
build_args: "build_env=int"
file: Dockerfile.build
file: Dockerfile.build.yarn

runs-on: ubuntu-latest
steps:
Expand Down
30 changes: 30 additions & 0 deletions Dockerfile.build.yarn
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM node:20.15.0-alpine AS build

ARG build_env

WORKDIR /app

COPY package.json .

RUN yarn install

COPY *.json .

COPY src/ src/

COPY scripts/ scripts/

RUN apk add gettext

RUN yarn build:${build_env}

FROM nginx:1.26.2-alpine

RUN mkdir -p /usr/share/nginx/html/orcid-web-frontend

COPY ./nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf

COPY --from=build /app/dist/ /usr/share/nginx/html/orcid-web-frontend/

EXPOSE 80

12 changes: 12 additions & 0 deletions docker-compose.build.yarn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '2'
services:
angular_yarn:
image: ${DOCKER_REG_PRIVATE}/orcid/registry/orcid-web-frontend-${BUILD_ENV:-qa}:${TAG:-0.0.1}
# entrypoint: sleep infinity
build:
context: .
dockerfile: Dockerfile.build.yarn
args:
build_env: ${BUILD_ENV:-qa}
ports:
- 0.0.0.0:13106:80

0 comments on commit 7387bf6

Please sign in to comment.