Skip to content

Commit

Permalink
Containerfile: install MOTIS in a separate stage
Browse files Browse the repository at this point in the history
  • Loading branch information
derhuerst committed Feb 26, 2024
1 parent 3737145 commit c98e80c
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions ci/container/Containerfile
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}

0 comments on commit c98e80c

Please sign in to comment.