Skip to content

Commit

Permalink
#731 docker multiplatform WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
joepio committed Dec 6, 2023
1 parent 1da934e commit 8e4778a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 31 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,31 +88,3 @@ jobs:
env:
# (required)
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: joepmeneer
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: joepmeneer/atomic-server
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }},joepmeneer/atomic-server:latest
labels: ${{ steps.meta.outputs.labels }}
23 changes: 20 additions & 3 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ build-all:
# Errors
# BUILD +cross-build --TARGET=aarch64-apple-darwin

docker-all:
BUILD --platform=linux/amd64 +docker-musl --TARGET=x86_64-unknown-linux-musl
BUILD --platform=linux/arm/v7 +docker-musl --TARGET=armv7-unknown-linux-musleabihf

install:
RUN apt-get update -qq
RUN rustup component add clippy
Expand Down Expand Up @@ -62,9 +66,22 @@ lint:
FROM +source
DO rust+CARGO --args="clippy --no-deps --all-features --all-targets"

docker-musl:
ARG tag="latest,sha-\$EARTHLY_GIT_SHORT_HASH"
ARG --required TARGET
COPY --chmod=0755 (+build/atomic-server --TARGET=${TARGET}) /atomic-server-bin
RUN /atomic-server-bin --version
# For a complete list of possible ENV vars or available flags, run with `--help`
ENV ATOMIC_DATA_DIR="/atomic-storage/data"
ENV ATOMIC_CONFIG_DIR="/atomic-storage/config"
ENV ATOMIC_PORT="80"
EXPOSE 80
VOLUME /atomic-storage
ENTRYPOINT ["/atomic-server-bin"]

docker:
FROM jeanblanchard/alpine-glibc:3.17.5
ARG tag="latest,\$EARTHLY_GIT_SHORT_HASH"
ARG tag="latest,sha-\$EARTHLY_GIT_SHORT_HASH"
# Some glibc deps are missing, installing it errors so ignore.
RUN apk add gcompat 2>/dev/null || true
COPY --chmod=0755 +build/atomic-server /atomic-server-bin
Expand All @@ -77,9 +94,9 @@ docker:
VOLUME /atomic-storage
ENTRYPOINT ["/atomic-server-bin"]
# Push to github container registry
# SAVE IMAGE --push ghcr.io/atomicdata-dev/atomic-server:${tag}
SAVE IMAGE --push ghcr.io/atomicdata-dev/atomic-server:${tag}
# Push to dockerhub
SAVE IMAGE --push joepmeneer/atomic-server:${tag}
# SAVE IMAGE --push joepmeneer/atomic-server:${tag}

setup-playwright:
FROM mcr.microsoft.com/playwright:v1.38.0-jammy
Expand Down

0 comments on commit 8e4778a

Please sign in to comment.