Skip to content

Commit

Permalink
Revert Dockerfile optimization
Browse files Browse the repository at this point in the history
- As environment variables are picked during build phase, we need to revert the dockerfile until we find a solution (it's better that the image takes 30 minutes to run that it doesn't work)
- Build docker image for ARM64. That should make Apple computers run the image faster
  • Loading branch information
Uxio0 committed Nov 16, 2023
1 parent 3598c18 commit c25e491
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 63 deletions.
55 changes: 40 additions & 15 deletions .github/workflows/deploy-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,50 @@ on:
jobs:
dockerhub-push:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || (github.event_name == 'release' && github.event.action == 'released')
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- uses: docker/setup-buildx-action@v3
- name: Dockerhub login
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Deploy Dockerhub main
- name: Deploy Main
if: github.ref == 'refs/heads/main'
run: bash scripts/github/deploy_docker.sh staging
env:
DOCKERHUB_PROJECT: ${{ secrets.DOCKER_PROJECT }}
- name: Deploy Dockerhub dev
uses: docker/build-push-action@v5
with:
push: true
tags: safeglobal/safe-wallet-web:staging
platforms: |
linux/amd64
linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Deploy Develop
if: github.ref == 'refs/heads/dev'
run: bash scripts/github/deploy_docker.sh dev
env:
DOCKERHUB_PROJECT: ${{ secrets.DOCKER_PROJECT }}
- name: Deploy Dockerhub tag
if: startsWith(github.ref, 'refs/tags/')
run: bash scripts/github/deploy_docker.sh ${GITHUB_REF##*/}
env:
DOCKERHUB_PROJECT: ${{ secrets.DOCKER_PROJECT }}
uses: docker/build-push-action@v5
with:
push: true
tags: safeglobal/safe-wallet-web:dev
platforms: |
linux/amd64
linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Deploy Tag
if: (github.event_name == 'release' && github.event.action == 'released')
uses: docker/build-push-action@v5
with:
push: true
tags: |
safeglobal/safe-wallet-web:${{ github.event.release.tag_name }}
safeglobal/safe-wallet-web:latest
platforms: |
linux/amd64
linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
35 changes: 11 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,21 @@
FROM node:18-alpine AS base
ENV NEXT_TELEMETRY_DISABLED 1

FROM base AS builder

FROM node:18-alpine
RUN apk add --no-cache libc6-compat git python3 py3-pip make g++ libusb-dev eudev-dev linux-headers
WORKDIR /app

# Install dependencies
COPY package.json yarn.lock* ./
RUN yarn --frozen-lockfile
COPY . .
RUN yarn run after-install

RUN yarn build

# Production image
FROM base AS runner
WORKDIR /app
# install deps
RUN yarn install --frozen-lockfile
RUN yarn after-install

ENV NODE_ENV production
ENV REVERSE_PROXY_UI_PORT 8080

RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs
COPY --from=builder /app/out ./out

# Set the correct permission for prerender cache
RUN mkdir .next && chown nextjs:nodejs .next
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
ENV NEXT_TELEMETRY_DISABLED 1

USER nextjs
EXPOSE 3000

EXPOSE ${REVERSE_PROXY_UI_PORT}
ENV PORT 3000

CMD npx -y serve out -p ${REVERSE_PROXY_UI_PORT}
CMD ["yarn", "static-serve"]
24 changes: 0 additions & 24 deletions scripts/github/deploy_docker.sh

This file was deleted.

0 comments on commit c25e491

Please sign in to comment.