fix: docker image building
This commit is contained in:
parent
5e54617325
commit
c205ebb710
8 changed files with 50 additions and 49 deletions
30
.github/workflows/scheduler.release.dev.yml
vendored
30
.github/workflows/scheduler.release.dev.yml
vendored
|
@ -20,7 +20,6 @@ jobs:
|
||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: '16.x'
|
node-version: '16.x'
|
||||||
- run: yarn install
|
|
||||||
- run: yarn test:scheduler
|
- run: yarn test:scheduler
|
||||||
|
|
||||||
publish-aws-ecr:
|
publish-aws-ecr:
|
||||||
|
@ -39,10 +38,6 @@ jobs:
|
||||||
- name: Login to Amazon ECR
|
- name: Login to Amazon ECR
|
||||||
id: login-ecr
|
id: login-ecr
|
||||||
uses: aws-actions/amazon-ecr-login@v1
|
uses: aws-actions/amazon-ecr-login@v1
|
||||||
- name: Install dependencies locally
|
|
||||||
run: yarn install
|
|
||||||
- name: Build application locally
|
|
||||||
run: yarn build:scheduler
|
|
||||||
- name: Build, tag, and push image to Amazon ECR
|
- name: Build, tag, and push image to Amazon ECR
|
||||||
id: build-image
|
id: build-image
|
||||||
env:
|
env:
|
||||||
|
@ -50,7 +45,7 @@ jobs:
|
||||||
ECR_REPOSITORY: scheduler-worker
|
ECR_REPOSITORY: scheduler-worker
|
||||||
IMAGE_TAG: ${{ github.sha }}
|
IMAGE_TAG: ${{ github.sha }}
|
||||||
run: |
|
run: |
|
||||||
docker build -f Dockerfile.scheduler -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
|
yarn docker build @standardnotes/scheduler-server -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
||||||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
||||||
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:dev
|
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:dev
|
||||||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:dev
|
docker push $ECR_REGISTRY/$ECR_REPOSITORY:dev
|
||||||
|
@ -62,21 +57,22 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Install dependencies locally
|
- name: Build image
|
||||||
run: yarn install
|
run: yarn docker build @standardnotes/scheduler-server -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
||||||
- name: Build application locally
|
- name: Publish to Registry (dev tag)
|
||||||
run: yarn build:scheduler
|
uses: manusa/actions-publish-docker@v1.1.2
|
||||||
- name: Publish to Registry
|
|
||||||
env:
|
|
||||||
DOCKER_BUILDKIT: 1
|
|
||||||
COMPOSE_DOCKER_CLI_BUILD: 1
|
|
||||||
uses: elgohr/Publish-Docker-Github-Action@master
|
|
||||||
with:
|
with:
|
||||||
name: standardnotes/scheduler
|
name: standardnotes/scheduler
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
dockerfile: Dockerfile.scheduler
|
tag: "dev"
|
||||||
tags: "dev,${{ github.sha }}"
|
- name: Publish to Registry (sha tag)
|
||||||
|
uses: manusa/actions-publish-docker@v1.1.2
|
||||||
|
with:
|
||||||
|
name: standardnotes/scheduler
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
tag: "${{ github.sha }}"
|
||||||
|
|
||||||
deploy-worker:
|
deploy-worker:
|
||||||
needs: publish-aws-ecr
|
needs: publish-aws-ecr
|
||||||
|
|
2
.github/workflows/version-bump.yml
vendored
2
.github/workflows/version-bump.yml
vendored
|
@ -32,7 +32,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
node-version: '16.x'
|
node-version: '16.x'
|
||||||
|
|
||||||
- run: yarn install
|
- run: yarn install --immutable
|
||||||
|
|
||||||
- name: Bump Prod Version
|
- name: Bump Prod Version
|
||||||
if: ${{ github.ref == 'refs/heads/main' }}
|
if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
|
|
8
.yarn/plugins/@yarnpkg/plugin-docker-build.cjs
vendored
Normal file
8
.yarn/plugins/@yarnpkg/plugin-docker-build.cjs
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,7 @@
|
||||||
plugins:
|
plugins:
|
||||||
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
|
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
|
||||||
spec: "@yarnpkg/plugin-workspace-tools"
|
spec: "@yarnpkg/plugin-workspace-tools"
|
||||||
|
- path: .yarn/plugins/@yarnpkg/plugin-docker-build.cjs
|
||||||
|
spec: "https://github.com/Dcard/yarn-plugins/releases/latest/download/plugin-docker-build.js"
|
||||||
|
|
||||||
yarnPath: .yarn/releases/yarn-3.2.1.cjs
|
yarnPath: .yarn/releases/yarn-3.2.1.cjs
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
FROM node:16.13.1-alpine3.15
|
|
||||||
|
|
||||||
ARG UID=1001
|
|
||||||
ARG GID=1001
|
|
||||||
|
|
||||||
RUN addgroup -S scheduler -g $GID && adduser -D -S scheduler -G scheduler -u $UID
|
|
||||||
|
|
||||||
RUN apk add --update --no-cache \
|
|
||||||
curl \
|
|
||||||
alpine-sdk \
|
|
||||||
python3
|
|
||||||
|
|
||||||
WORKDIR /var/www
|
|
||||||
|
|
||||||
RUN chown -R $UID:$GID .
|
|
||||||
|
|
||||||
USER scheduler
|
|
||||||
|
|
||||||
COPY --chown=$UID:$GID packages/scheduler/package.json .yarnrc.yml /var/www/
|
|
||||||
COPY --chown=$UID:$GID .yarn /var/www/.yarn
|
|
||||||
COPY --chown=$UID:$GID packages/scheduler/dist /var/www/dist
|
|
||||||
COPY --chown=$UID:$GID packages/scheduler/docker /var/www/docker
|
|
||||||
|
|
||||||
RUN yarn install
|
|
||||||
|
|
||||||
ENTRYPOINT [ "docker/entrypoint.sh" ]
|
|
||||||
|
|
||||||
CMD [ "start-worker" ]
|
|
23
packages/scheduler/Dockerfile
Normal file
23
packages/scheduler/Dockerfile
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
FROM node:16.13.1-alpine AS builder
|
||||||
|
|
||||||
|
# Install dependencies for building native libraries
|
||||||
|
RUN apk add --update git openssh-client python3 alpine-sdk
|
||||||
|
|
||||||
|
WORKDIR /workspace
|
||||||
|
|
||||||
|
# docker-build plugin copies everything needed for `yarn install` to `manifests` folder.
|
||||||
|
COPY manifests ./
|
||||||
|
|
||||||
|
RUN yarn install --immutable
|
||||||
|
|
||||||
|
FROM node:16.13.1-alpine
|
||||||
|
|
||||||
|
WORKDIR /workspace
|
||||||
|
|
||||||
|
# Copy the installed dependencies from the previous stage.
|
||||||
|
COPY --from=builder /workspace ./
|
||||||
|
|
||||||
|
# docker-build plugin runs `yarn pack` in all workspace dependencies and copies them to `packs` folder.
|
||||||
|
COPY packs ./
|
||||||
|
|
||||||
|
CMD yarn workspace @standardnotes/scheduler-server worker
|
|
@ -36,7 +36,7 @@
|
||||||
"ioredis": "^5.0.6",
|
"ioredis": "^5.0.6",
|
||||||
"mysql2": "^2.3.3",
|
"mysql2": "^2.3.3",
|
||||||
"newrelic": "8.6.0",
|
"newrelic": "8.6.0",
|
||||||
"reflect-metadata": "0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"typeorm": "^0.3.6",
|
"typeorm": "^0.3.6",
|
||||||
"winston": "3.3.3"
|
"winston": "3.3.3"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1757,7 +1757,7 @@ __metadata:
|
||||||
ioredis: ^5.0.6
|
ioredis: ^5.0.6
|
||||||
mysql2: ^2.3.3
|
mysql2: ^2.3.3
|
||||||
newrelic: 8.6.0
|
newrelic: 8.6.0
|
||||||
reflect-metadata: 0.1.13
|
reflect-metadata: ^0.1.13
|
||||||
typeorm: ^0.3.6
|
typeorm: ^0.3.6
|
||||||
winston: 3.3.3
|
winston: 3.3.3
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
|
@ -7151,7 +7151,7 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"reflect-metadata@npm:0.1.13, reflect-metadata@npm:^0.1.13":
|
"reflect-metadata@npm:^0.1.13":
|
||||||
version: 0.1.13
|
version: 0.1.13
|
||||||
resolution: "reflect-metadata@npm:0.1.13"
|
resolution: "reflect-metadata@npm:0.1.13"
|
||||||
checksum: 798d379a7b6f6455501145419505c97dd11cbc23857a386add2b9ef15963ccf15a48d9d15507afe01d4cd74116df8a213247200bac00320bd7c11ddeaa5e8fb4
|
checksum: 798d379a7b6f6455501145419505c97dd11cbc23857a386add2b9ef15963ccf15a48d9d15507afe01d4cd74116df8a213247200bac00320bd7c11ddeaa5e8fb4
|
||||||
|
|
Loading…
Reference in a new issue