-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Containerfile: install MOTIS in a separate stage
- Loading branch information
Showing
1 changed file
with
17 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,39 @@ | ||
# SPDX-FileCopyrightText: 2024 Jonah Brüchert <[email protected]> | ||
# SPDX-License-Identifier: CC0-1.0 | ||
|
||
FROM docker.io/debian:bookworm-slim | ||
FROM docker.io/debian:bookworm-slim AS motis | ||
|
||
ARG MOTIS_VERSION=v0.11.20 | ||
|
||
RUN apt-get update -y && \ | ||
apt-get install -y --no-install-recommends bzip2 ca-certificates wget && \ | ||
apt-get clean -y && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN wget -qO - https://github.com/motis-project/motis/releases/download/${MOTIS_VERSION}/motis-linux-amd64.tar.bz2 | tar -C /opt/ -jx | ||
|
||
FROM docker.io/debian:bookworm-slim | ||
|
||
ARG USERNAME=transitous | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
|
||
RUN apt-get update -y && \ | ||
apt-get install -y --no-install-recommends git python3-requests python3-jinja2 golang wget bzip2 && \ | ||
apt-get install -y --no-install-recommends git python3-requests python3-jinja2 golang && \ | ||
apt-get clean -y && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN wget -qO - https://github.com/motis-project/motis/releases/download/${MOTIS_VERSION}/motis-linux-amd64.tar.bz2 | tar -C /opt/ -jx | ||
# install MOTIS from `motis` stage | ||
COPY --from=motis /opt/motis /opt/motis | ||
RUN \ | ||
chown -R "$USER_UID:$USER_GID" /opt/motis | ||
ENV PATH=/opt/motis:$PATH | ||
|
||
RUN GOBIN=/usr/local/bin/ go install github.com/patrickbr/gtfstidy@latest | ||
|
||
# Create the user / set user rights | ||
RUN groupadd --gid $USER_GID $USERNAME && \ | ||
useradd --uid $USER_UID --gid $USER_GID -m $USERNAME && \ | ||
mkdir /workspace && chown -R $USER_UID:$USER_GID /workspace && \ | ||
chown -R $USER_UID:$USER_GID /opt/motis | ||
mkdir /workspace && chown -R $USER_UID:$USER_GID /workspace | ||
|
||
USER ${USERNAME} |