Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi arch Docker image builds #1134

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
**/.git/
**/.github/
**/node_modules/

**/Dockerfile
**/Dockerfile.*

**/.env.*.local
**/.env.local
58 changes: 55 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,60 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
node-version: '18.x'
- run: DOCKER_PASSWORD=${{ secrets.DOCKERHUB_TOKEN }} DOCKER_USERNAME=${{ secrets.DOCKERHUB_USERNAME }} bash scripts/docker.sh
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: deepstreamio/deepstream.io
flavor: |
latest=true
tags: |
type=semver,pattern={{version}}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

docker-alpine:
runs-on: ubuntu-latest
steps:
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: deepstreamio/deepstream.io
flavor: |
latest=true
suffix=-alpine,onlatest=true
tags: |
type=semver,pattern={{version}}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.alpine
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
17 changes: 12 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM node:10

FROM node:18 as builder
WORKDIR /app
# RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
# RUN unzip awscliv2.zip
# RUN ./aws/install

COPY package*.json ./

RUN npm ci
RUN npm install --production \
@deepstream/cache-redis \
# @deepstream/cache-memcached \
Expand All @@ -18,11 +19,17 @@ RUN npm install --production \
@deepstream/logger-winston \
@deepstream/plugin-aws

COPY . ./
COPY . .

RUN npm run tsc

FROM node:18
WORKDIR /usr/local/deepstream
COPY --from=builder /app/node_modules/ ./node_modules
COPY --from=builder /app/dist/ .

EXPOSE 6020
EXPOSE 8080
EXPOSE 9229

CMD ["node", "./bin/deepstream.js", "start", "--inspect=0.0.0.0:9229"]

CMD ["node", "./bin/deepstream.js", "start", "--inspect=0.0.0.0:9229"]
37 changes: 37 additions & 0 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM node:18-alpine as builder
WORKDIR /app
# RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
# RUN unzip awscliv2.zip
# RUN ./aws/install

COPY package*.json ./

RUN npm ci
RUN npm install --production \
@deepstream/cache-redis \
# @deepstream/cache-memcached \
# @deepstream/cache-hazelcast \
@deepstream/clusternode-redis \
@deepstream/storage-mongodb \
@deepstream/storage-rethinkdb \
@deepstream/storage-elasticsearch \
@deepstream/storage-postgres \
@deepstream/logger-winston \
@deepstream/plugin-aws

RUN npm uninstall --save uWebSockets.js

COPY . .

RUN npm run tsc

FROM node:18-alpine
WORKDIR /usr/local/deepstream
COPY --from=builder /app/node_modules/ ./node_modules
COPY --from=builder /app/dist/ .

EXPOSE 6020
EXPOSE 8080
EXPOSE 9229

CMD ["node", "./bin/deepstream.js", "start", "--inspect=0.0.0.0:9229"]
25 changes: 0 additions & 25 deletions scripts/docker.sh

This file was deleted.