2022-02-10 07:43:47 +00:00
|
|
|
# Mentorenwahl: A fullstack application for assigning mentors to students based on their whishes.
|
|
|
|
# Copyright (C) 2022 Dominic Grimm
|
|
|
|
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
2022-02-02 14:38:36 +00:00
|
|
|
FROM crystallang/crystal:1.3-alpine as deps
|
2022-01-08 12:29:22 +00:00
|
|
|
WORKDIR /app
|
|
|
|
COPY ./shard.yml ./shard.lock ./
|
2022-01-20 16:32:15 +00:00
|
|
|
RUN shards install --production
|
2022-01-08 12:29:22 +00:00
|
|
|
|
2022-02-02 14:38:36 +00:00
|
|
|
FROM crystallang/crystal:1.3-alpine as builder
|
2022-01-08 12:29:22 +00:00
|
|
|
ARG BUILD_ENV
|
2022-02-06 20:56:50 +00:00
|
|
|
WORKDIR /app/backend
|
2022-01-08 12:29:22 +00:00
|
|
|
COPY --from=deps /app/shard.yml /app/shard.lock ./
|
|
|
|
COPY --from=deps /app/lib ./lib
|
2022-02-06 20:56:50 +00:00
|
|
|
COPY ./LICENSE ./LICENSE
|
2022-02-09 15:32:39 +00:00
|
|
|
COPY ./Makefile ./Makefile
|
2022-01-08 12:29:22 +00:00
|
|
|
COPY ./src ./src
|
2022-01-10 16:53:38 +00:00
|
|
|
RUN if [ "${BUILD_ENV}" = "development" ]; then \
|
2022-02-07 18:25:18 +00:00
|
|
|
make dev; \
|
2022-01-10 16:53:38 +00:00
|
|
|
else \
|
2022-02-07 18:25:18 +00:00
|
|
|
make; \
|
2022-01-10 16:53:38 +00:00
|
|
|
fi
|
2022-01-20 16:30:20 +00:00
|
|
|
|
2022-01-28 17:30:20 +00:00
|
|
|
FROM alpine as runner
|
2022-01-20 16:30:20 +00:00
|
|
|
WORKDIR /app
|
2022-01-29 15:40:39 +00:00
|
|
|
RUN adduser -S backend -u 1001
|
2022-02-06 20:56:50 +00:00
|
|
|
COPY --from=builder /app/backend/bin ./bin
|
2022-01-10 12:50:42 +00:00
|
|
|
COPY ./db ./db
|
2022-01-23 08:12:57 +00:00
|
|
|
USER backend
|
2022-01-15 19:04:31 +00:00
|
|
|
EXPOSE 80
|
2022-01-28 17:30:20 +00:00
|
|
|
ENTRYPOINT [ "./bin/backend" ]
|
2022-01-23 08:12:57 +00:00
|
|
|
CMD [ "run" ]
|