Skip to content

Commit

Permalink
Chore: fix docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed Jan 7, 2025
1 parent 5bcc4c7 commit 1ae7240
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 60 deletions.
99 changes: 48 additions & 51 deletions .github/workflows/web-deploy-dockerhub.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# web-core image is meant to be used only by our safe-infrastructure repository
# This Docker image is meant to be used only by our safe-infrastructure repository

name: Web Deploy to Dockerhub
name: Web Deploy to Dockerhub

on:
push:
Expand All @@ -10,58 +10,55 @@ on:
paths:
- apps/web/**
release:
types: [ released ]
types: [released]

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@v4
- uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- uses: docker/setup-buildx-action@v3
- name: Dockerhub login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Deploy Main
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v6
with:
context: ./apps/web
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'
uses: docker/build-push-action@v6
with:
context: ./apps/web
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@v6
with:
context: ./apps/web
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
- 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@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Deploy Main
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v6
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'
uses: docker/build-push-action@v6
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@v6
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
23 changes: 14 additions & 9 deletions apps/web/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
FROM node:18-alpine
RUN apk add --no-cache libc6-compat git python3 py3-pip make g++ libusb-dev eudev-dev linux-headers

# Set working directory
WORKDIR /app

# Copy root
COPY . .

# Set working directory to the web app
WORKDIR apps/web

# Enable corepack and configure yarn
RUN corepack enable
# Fix arm64 timeouts
RUN yarn config set httpTimeout 300000

# install deps
# Run any custom post-install scripts
RUN yarn install --immutable
RUN yarn after-install

# Set environment variables
ENV NODE_ENV production

# 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
ENV PORT 3000

# Expose the port
EXPOSE 3000

ENV PORT 3000

CMD ["yarn", "static-serve"]
# Command to start the application
CMD ["yarn", "static-serve"]

0 comments on commit 1ae7240

Please sign in to comment.