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'
|
name: 'File-uploader-crystal CI'
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# workflow_dispatch:
|
workflow_dispatch:
|
||||||
# inputs: {}
|
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 7 * * 0'
|
- cron: '0 7 * * 0'
|
||||||
push:
|
push:
|
||||||
|
@ -28,14 +27,14 @@ jobs:
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: https://github.com/docker/metadata-action@v5
|
uses: https://github.com/docker/metadata-action@v6
|
||||||
with:
|
with:
|
||||||
images: git.nadeko.net/fijxu/file-uploader-crystal
|
images: git.nadeko.net/fijxu/file-uploader-crystal
|
||||||
tags: |
|
tags: |
|
||||||
type=sha,format=short,prefix={{date 'YYYY.MM.DD'}}-,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
|
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') }}
|
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
|
name: Build images
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
|
@ -43,5 +42,5 @@ jobs:
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
push: true
|
push: true
|
||||||
build-args: |
|
cache-from: type=gha
|
||||||
"release=1"
|
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
|
# 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
|
RUN apk add --no-cache sqlite-static yaml-static
|
||||||
|
|
||||||
ARG release
|
|
||||||
|
|
||||||
WORKDIR /file-uploader-crystal
|
WORKDIR /file-uploader-crystal
|
||||||
|
|
||||||
COPY ./shard.yml ./shard.yml
|
COPY ./shard.yml ./shard.yml
|
||||||
COPY ./shard.lock ./shard.lock
|
COPY ./shard.lock ./shard.lock
|
||||||
RUN shards install --production
|
RUN shards install --production
|
||||||
|
@ -15,21 +14,29 @@ COPY ./src/ ./src/
|
||||||
# See definition of CURRENT_BRANCH, CURRENT_COMMIT and CURRENT_VERSION.
|
# See definition of CURRENT_BRANCH, CURRENT_COMMIT and CURRENT_VERSION.
|
||||||
COPY ./.git/ ./.git/
|
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 \
|
--release \
|
||||||
--static --warnings all
|
--static --warnings all
|
||||||
|
|
||||||
FROM alpine:3.20
|
# 2nd stage
|
||||||
|
FROM alpine:3.21
|
||||||
RUN apk add --no-cache tini ffmpeg
|
RUN apk add --no-cache tini ffmpeg
|
||||||
|
|
||||||
WORKDIR /file-uploader-crystal
|
WORKDIR /file-uploader-crystal
|
||||||
|
|
||||||
RUN addgroup -g 1000 -S file-uploader-crystal && \
|
RUN addgroup -g 1000 -S file-uploader-crystal && \
|
||||||
adduser -u 1000 -S file-uploader-crystal -G 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
|
RUN mv -n config/config.example.yml config/config.yml
|
||||||
COPY --from=builder /file-uploader-crystal/file-uploader-crystal .
|
COPY --from=builder /file-uploader-crystal/file-uploader-crystal /file-uploader-crystal
|
||||||
RUN chmod o+rX -R ./config
|
RUN chmod o+rX -R /file-uploader-crystal/file-uploader-crystal
|
||||||
|
RUN chown file-uploader-crystal: -R /file-uploader-crystal
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
USER file-uploader-crystal
|
USER file-uploader-crystal
|
||||||
|
|
||||||
ENTRYPOINT ["/sbin/tini", "--"]
|
ENTRYPOINT ["/sbin/tini", "--"]
|
||||||
|
|
||||||
CMD [ "/file-uploader-crystal/file-uploader-crystal" ]
|
CMD [ "/file-uploader-crystal/file-uploader-crystal" ]
|
||||||
|
|
Loading…
Add table
Reference in a new issue