Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve extra Docker image, add a Debian-based #321

Merged
merged 5 commits into from
Jun 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/pythonpackage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,15 @@ jobs:
- name: Run Docker image
run: |
docker run -v "$(pwd):/data" reuse
- name: Build Dockerfile-extra
run: |
docker build -t reuse-extra --file Dockerfile-extra .
- name: Run Docker extra image
run: |
docker run -v "$(pwd):/data" reuse-extra
- name: Build Dockerfile-debian
run: |
docker build -t reuse-debian --file Dockerfile-debian .
- name: Run Docker debian image
run: |
docker run -v "$(pwd):/data" reuse-debian
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ The versions follow [semantic versioning](https://semver.org).

- `addheader` ignores case when matching file extensions and names. (#359)

- Provide `latest-debian` as Docker Hub tag, created by `Dockerfile-debian`. (#321)

- More file types are recognised:

- Javascript modules (`.mjs`)
Expand Down
39 changes: 39 additions & 0 deletions Dockerfile-debian
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# SPDX-FileCopyrightText: 2021 Free Software Foundation Europe e.V. <https://fsfe.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later

# Like normal Dockerfile, but based on python:slim (Debian) to ease compliance

# Create a base image that has dependencies installed.
FROM python:slim AS base

RUN apt-get update \
&& apt-get install -y git mercurial \
&& rm -rf /var/lib/apt/lists/*

# Build reuse into a virtualenv
FROM base AS build

WORKDIR /reuse-tool

ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

COPY . /reuse-tool/

RUN pip3 install -r requirements.txt
RUN pip3 install .


# Copy over the virtualenv and use it
FROM base
COPY --from=build /opt/venv /opt/venv

ENV VIRTUAL_ENV=/opt/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

WORKDIR /data

ENTRYPOINT ["reuse"]
CMD ["lint"]
35 changes: 32 additions & 3 deletions Dockerfile-extra
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,36 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later

# Use fsfe/reuse:latest as a base, and install additional packages on top
FROM fsfe/reuse:latest
# Like normal Dockerfile, but install additional packages on top

RUN apk --no-cache add openssh-client
# Create a base image that has dependencies installed.
FROM alpine:3.11 AS base
mxmehl marked this conversation as resolved.
Show resolved Hide resolved

RUN apk --no-cache add git mercurial python3 openssh-client

# Build reuse into a virtualenv
FROM base AS build

WORKDIR /reuse-tool

ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

COPY . /reuse-tool/

RUN pip3 install -r requirements.txt
RUN pip3 install .


# Copy over the virtualenv and use it
FROM base
COPY --from=build /opt/venv /opt/venv

ENV VIRTUAL_ENV=/opt/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

WORKDIR /data

ENTRYPOINT ["reuse"]
CMD ["lint"]
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,14 @@ You can also provide additional arguments, like so:
docker run --rm --volume $(pwd):/data fsfe/reuse --include-submodules spdx -o out.spdx
```

There are a number of tags available:
- `latest` is the most recent stable release.
- `dev` follows the `master` branch of this repository. Up-to-date, but
potentially unstable.
- `latest-extra` has a few extra packages installed, currently `openssh-client`.
- `latest-debian` is based on `python:slim`. It is larger, but may be better
suited for license compliance.

### Run as pre-commit hook

You can automatically run `reuse lint` on every commit as a pre-commit hook for
Expand Down