mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 17:14:02 +03:00
Merge pull request #398 from 9seconds/docker-directory
Allow using directory bind mounts for a docker container
This commit is contained in:
+15
-1
@@ -5,6 +5,19 @@ FROM golang:1.26-alpine AS build
|
|||||||
|
|
||||||
ENV CGO_ENABLED=0
|
ENV CGO_ENABLED=0
|
||||||
|
|
||||||
|
# this is done for backward compatibility: before that we mounted a config
|
||||||
|
# into /config.toml. Some application allow mounting directories only,
|
||||||
|
# so it makes problems. So, instead we are going to do 2 steps:
|
||||||
|
# 1. Create /config/config.toml as a symlink to /config.toml
|
||||||
|
# 2. Force /mtg to use /config/config.toml
|
||||||
|
#
|
||||||
|
# it helps in both ways: users with directories could use /config directory
|
||||||
|
# and overlap a symlink by their bind mount. Old users could continue using
|
||||||
|
# /config.toml as a real config.
|
||||||
|
RUN set -x \
|
||||||
|
&& mkdir -p /config \
|
||||||
|
&& ln -sv /config.toml /config/config.toml
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/var/cache/apk \
|
RUN --mount=type=cache,target=/var/cache/apk \
|
||||||
set -x \
|
set -x \
|
||||||
&& apk --update add \
|
&& apk --update add \
|
||||||
@@ -35,8 +48,9 @@ RUN set -x \
|
|||||||
FROM scratch
|
FROM scratch
|
||||||
|
|
||||||
ENTRYPOINT ["/mtg"]
|
ENTRYPOINT ["/mtg"]
|
||||||
CMD ["run", "/config.toml"]
|
CMD ["run", "/config/config.toml"]
|
||||||
|
|
||||||
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
COPY --from=build /app/mtg /mtg
|
COPY --from=build /app/mtg /mtg
|
||||||
COPY --from=build /app/example.config.toml /config.toml
|
COPY --from=build /app/example.config.toml /config.toml
|
||||||
|
COPY --from=build /config /config
|
||||||
|
|||||||
Reference in New Issue
Block a user