Skip to content

Commit

Permalink
ci: try building multi-arch docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
pikdum committed Sep 14, 2024
1 parent 7c3d977 commit b147c02
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 7 deletions.
5 changes: 3 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
_build
db
deps
.git
.elixir_ls
maps
priv
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build

on:
push:
branches:
- master

jobs:
build:
name: Build
runs-on: ubuntu-latest
concurrency: build
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ghcr.io/pikdum/thistle_tea:latest
platforms: linux/amd64,linux/arm64
- uses: snok/container-retention-policy@v2
with:
image-names: pikdum/thistle_tea
cut-off: 1 day ago utc
keep-at-least: 1
account-type: personal
token: ${{ secrets.GITHUB_TOKEN }}
token-type: github-token
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM elixir:1.17-alpine AS build
ENV MIX_ENV prod
FROM elixir:1.17 AS build
ENV MIX_ENV=prod
COPY --from=rust:latest /usr/local/cargo/bin/* /usr/local/bin/
RUN rustup default stable
WORKDIR /app
RUN mix local.hex --force && mix local.rebar --force
COPY mix.exs mix.lock ./
Expand All @@ -8,11 +10,9 @@ COPY . .
RUN mix compile
RUN mix release

FROM elixir:1.17-alpine
FROM elixir:1.17
WORKDIR /app
COPY --from=build /app/_build/prod/rel/thistle_tea ./
COPY --from=build /app/mangos0.sqlite ./
COPY --from=build /app/dbc.sqlite ./
EXPOSE 3724
EXPOSE 8085
CMD ["/app/bin/thistle_tea", "start"]

0 comments on commit b147c02

Please sign in to comment.