Skip to content

Commit

Permalink
Add a Containerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
pierreprinetti committed Sep 6, 2024
1 parent eb33c77 commit 88941ef
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 3 deletions.
23 changes: 23 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# syntax=docker/dockerfile:1

FROM docker.io/library/golang:1.22 AS build

WORKDIR /src

COPY go.mod go.sum ./
RUN go mod download

COPY ./pkg ./pkg
COPY ./cmd ./cmd

RUN CGO_ENABLED=0 GOOS=linux go build -o /openstack-proxy ./cmd/openstack-proxy

FROM registry.access.redhat.com/ubi8/ubi-minimal:latest

ENV OS_CLOUD=openstack OS_CLIENT_CONFIG_FILE=/config/clouds.yaml

EXPOSE 13000

COPY --from=build /openstack-proxy /

ENTRYPOINT ["/openstack-proxy"]
39 changes: 36 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,54 @@ By default the server will listen on localhost on port 13000.

### Local server

```shell
```bash
export OS_CLOUD=openstack
./openstack-proxy -o proxied-clouds.yaml
```
```shell
```bash
export OS_CLIENT_CONFIG_FILE=./proxied-clouds.yaml
openstack server list
```

### On the network, with HTTPS

```shell
```bash
./openstack-proxy \
--url https://myserver.example.com:13000 \
--cert /var/run/osp-cert.pem \
--key /var/run/osp-key.pem' \
-o proxied-clouds.yaml
```
## Containerized
An image of `openstack-proxy` is available on `quay.io/pierreprinetti/openstack-proxy`.
Here is an example of how to use it. This example uses the clouds.yaml in the
default location, edit as necessary:
```bash
export OS_CLOUD=openstack # Name of the target cloud in clouds.yaml
export OS_CLIENT_CONFIG_FILE="$(mktemp -d)/clouds.yaml" # Where to write the generated clouds.yaml
podman run \
--name openstack-proxy \
-d \
--rm \
-v ${XDG_CONFIG_HOME:-${HOME}/.config}/openstack/clouds.yaml:/config/clouds.yaml:Z,ro \
-v $(dirname "$OS_CLIENT_CONFIG_FILE"):/out:z \
--env OS_CLOUD=$OS_CLOUD \
-p 13000:13000 \
quay.io/pierreprinetti/openstack-proxy -o "/out/$(basename "$OS_CLIENT_CONFIG_FILE")"
```
Logs can be inspected in a separate terminal:
```bash
podman container logs --follow openstack-proxy
```
To terminate the container:
```bash
podman container stop openstack-proxy
```

0 comments on commit 88941ef

Please sign in to comment.