update dockerfile and ci
Some checks failed
File-uploader-crystal CI / build (push) Failing after 28s
Some checks failed
File-uploader-crystal CI / build (push) Failing after 28s
This commit is contained in:
parent
b19c423648
commit
b65acac27d
2 changed files with 20 additions and 14 deletions
|
@ -1,8 +1,7 @@
|
|||
name: 'File-uploader-crystal CI'
|
||||
|
||||
on:
|
||||
# workflow_dispatch:
|
||||
# inputs: {}
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 7 * * 0'
|
||||
push:
|
||||
|
@ -28,14 +27,14 @@ jobs:
|
|||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: https://github.com/docker/metadata-action@v5
|
||||
uses: https://github.com/docker/metadata-action@v6
|
||||
with:
|
||||
images: git.nadeko.net/fijxu/file-uploader-crystal
|
||||
tags: |
|
||||
type=sha,format=short,prefix={{date 'YYYY.MM.DD'}}-,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
|
||||
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
|
||||
|
||||
- uses: https://code.forgejo.org/docker/build-push-action@v5
|
||||
- uses: https://code.forgejo.org/docker/build-push-action@v6
|
||||
name: Build images
|
||||
with:
|
||||
context: .
|
||||
|
@ -43,5 +42,5 @@ jobs:
|
|||
tags: ${{ steps.meta.outputs.tags }}
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
build-args: |
|
||||
"release=1"
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
|
23
Dockerfile
23
Dockerfile
|
@ -1,11 +1,10 @@
|
|||
# Based on https://github.com/iv-org/invidious/blob/master/docker/Dockerfile
|
||||
FROM crystallang/crystal:1.14.0-alpine AS builder
|
||||
FROM crystallang/crystal:1.16.1-alpine AS builder
|
||||
|
||||
RUN apk add --no-cache sqlite-static yaml-static
|
||||
|
||||
ARG release
|
||||
|
||||
WORKDIR /file-uploader-crystal
|
||||
|
||||
COPY ./shard.yml ./shard.yml
|
||||
COPY ./shard.lock ./shard.lock
|
||||
RUN shards install --production
|
||||
|
@ -15,21 +14,29 @@ COPY ./src/ ./src/
|
|||
# See definition of CURRENT_BRANCH, CURRENT_COMMIT and CURRENT_VERSION.
|
||||
COPY ./.git/ ./.git/
|
||||
|
||||
RUN crystal build ./src/file-uploader-crystal.cr \
|
||||
RUN --mount=type=cache,target=/root/.cache/crystal \
|
||||
crystal build ./src/file-uploader-crystal.cr \
|
||||
--release \
|
||||
--static --warnings all
|
||||
|
||||
FROM alpine:3.20
|
||||
# 2nd stage
|
||||
FROM alpine:3.21
|
||||
RUN apk add --no-cache tini ffmpeg
|
||||
|
||||
WORKDIR /file-uploader-crystal
|
||||
|
||||
RUN addgroup -g 1000 -S file-uploader-crystal && \
|
||||
adduser -u 1000 -S file-uploader-crystal -G file-uploader-crystal
|
||||
COPY --chown=file-uploader-crystal ./config/config.* ./config/
|
||||
|
||||
COPY --chown=file-uploader-crystal ./config/config.example.yml ./config/
|
||||
RUN mv -n config/config.example.yml config/config.yml
|
||||
COPY --from=builder /file-uploader-crystal/file-uploader-crystal .
|
||||
RUN chmod o+rX -R ./config
|
||||
COPY --from=builder /file-uploader-crystal/file-uploader-crystal /file-uploader-crystal
|
||||
RUN chmod o+rX -R /file-uploader-crystal/file-uploader-crystal
|
||||
RUN chown file-uploader-crystal: -R /file-uploader-crystal
|
||||
|
||||
EXPOSE 8080
|
||||
USER file-uploader-crystal
|
||||
|
||||
ENTRYPOINT ["/sbin/tini", "--"]
|
||||
|
||||
CMD [ "/file-uploader-crystal/file-uploader-crystal" ]
|
||||
|
|
Loading…
Add table
Reference in a new issue