Embed licenses of used projects in final binary #109

Merged
dergrimm merged 1 commit from compiled-license into main 2022-04-06 16:22:27 +00:00
4 changed files with 14 additions and 6 deletions

View file

@ -28,11 +28,12 @@ RUN rm -rf ./tmp_dist
FROM crystallang/crystal:1.3-alpine as builder
ARG BUILD_ENV
WORKDIR /src
WORKDIR /src/mentorenwahl
RUN apk add --no-cache pcre2-dev
COPY --from=deps /app/shard.yml /app/shard.lock ./
COPY --from=deps /app/lib ./lib
COPY ./Makefile ./Makefile
COPY ./LICENSE .
COPY ./Makefile .
COPY ./src ./src
COPY --from=public-minify /src/dist ./public
RUN if [ "${BUILD_ENV}" = "development" ]; then \
@ -42,7 +43,7 @@ RUN if [ "${BUILD_ENV}" = "development" ]; then \
fi
FROM scratch as runner
COPY --from=builder /src/bin /bin
COPY --from=builder /src/mentorenwahl/bin /bin
EXPOSE 80
ENTRYPOINT [ "backend" ]
CMD [ "run" ]

View file

@ -52,6 +52,10 @@ shards:
git: https://github.com/mrrooijen/commander.git
version: 0.4.0
compiled_license:
git: https://git.dergrimm.net/dergrimm/compiled_license.git
version: 2.0.0
db:
git: https://github.com/crystal-lang/crystal-db.git
version: 0.11.0

View file

@ -67,3 +67,5 @@ dependencies:
github: athena-framework/framework
baked_file_system:
github: schovi/baked_file_system
compiled_license:
git: https://git.dergrimm.net/dergrimm/compiled_license.git

View file

@ -16,6 +16,7 @@
require "commander"
require "../backend"
require "compiled_license"
Backend::Db.init
@ -48,12 +49,12 @@ cli = Commander::Command.new do |cmd|
end
cmd.commands.add do |c|
c.use = "license"
c.short = "Prints license"
c.use = "licenses"
c.short = "Prints licenses of projects used by this programs"
c.long = c.short
c.run do
puts Backend::LICENSE
puts CompiledLicense::LICENSES
end
end