Skip to content

Commit

Permalink
Chore: fix docker build (#4740)
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh authored Jan 7, 2025
1 parent 5bcc4c7 commit 6267e89
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 60 deletions.
106 changes: 55 additions & 51 deletions .github/workflows/web-deploy-dockerhub.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,71 @@
# 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:
pull_request:
branches:
- docker
paths:
- apps/web/**

push:
branches:
- main
- dev
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
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +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
RUN yarn config set httpTimeout 300000

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

# Set environment variables
ENV NODE_ENV production

Check warning on line 22 in Dockerfile

View workflow job for this annotation

GitHub Actions / dockerhub-push

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
ENV NEXT_TELEMETRY_DISABLED 1

Check warning on line 23 in Dockerfile

View workflow job for this annotation

GitHub Actions / dockerhub-push

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
ENV PORT 3000

Check warning on line 24 in Dockerfile

View workflow job for this annotation

GitHub Actions / dockerhub-push

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/

# Expose the port
EXPOSE 3000

# Command to start the application
CMD ["yarn", "static-serve"]
23 changes: 14 additions & 9 deletions apps/web/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 6267e89

Please sign in to comment.