Skip to content

Commit

Permalink
chore(server): remove docker-compose and cleanup (Jigsaw-Code#1484)
Browse files Browse the repository at this point in the history
  • Loading branch information
fortuna authored Jan 30, 2024
1 parent 33de2a9 commit 71e4b52
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 115 deletions.
48 changes: 22 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"generate-license-file": "^1.2.0",
"husky": "^1.3.1",
"jasmine": "^3.5.0",
"minimist": "^1.2.8",
"prettier": "^2.4.1",
"pretty-quick": "^3.1.1",
"typescript": "^4.9.5"
Expand Down
5 changes: 2 additions & 3 deletions src/shadowbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ Shadowbox supports running on linux and macOS hosts.

Besides [Node](https://nodejs.org/en/download/) you will also need:

1. [Docker 1.13+](https://docs.docker.com/engine/installation/)
2. [docker-compose 1.11+](https://docs.docker.com/compose/install/)
1. [Docker Engine](https://docs.docker.com/engine/installation/)

### Running Shadowbox as a Node.js app

Expand Down Expand Up @@ -69,7 +68,7 @@ npm run action shadowbox/docker/build
Debug image:

```
docker run --rm -it --entrypoint=sh outline/shadowbox
docker run --rm -it --entrypoint=sh localhost/outline/shadowbox
```

Or a running container:
Expand Down
7 changes: 5 additions & 2 deletions src/shadowbox/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ WORKDIR /
# Don't copy node_modules and other things not needed for install.
COPY package.json package-lock.json ./
COPY src/shadowbox/package.json src/shadowbox/
RUN npm ci
RUN --mount=type=cache,target=/root/.npm npm ci

# We copy the source code only after npm ci, so that source code changes don't trigger re-installs.
COPY scripts scripts/
Expand All @@ -46,8 +46,11 @@ LABEL shadowbox.node_version=16.18.0
ARG GITHUB_RELEASE
LABEL shadowbox.github.release="${GITHUB_RELEASE}"

# The user management service doesn't quit with SIGTERM.
STOPSIGNAL SIGKILL

# We use curl to detect the server's public IP. We need to use the --date option in `date` to
# safely grab the ip-to-country database
# safely grab the ip-to-country database.
RUN apk add --no-cache --upgrade coreutils curl

COPY src/shadowbox/scripts scripts/
Expand Down
6 changes: 1 addition & 5 deletions src/shadowbox/docker/build.action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,10 @@ readonly NODE_IMAGE=$(
fi
)

# Doing an explicit `docker pull` of the container base image to work around an issue where
# Travis fails to pull the base image when using BuildKit. Seems to be related to:
# https://github.com/moby/buildkit/issues/606 and https://github.com/moby/buildkit/issues/1397
docker pull "${NODE_IMAGE}"
docker build --force-rm \
--build-arg ARCH="${ARCH}" \
--build-arg NODE_IMAGE="${NODE_IMAGE}" \
--build-arg GITHUB_RELEASE="${TRAVIS_TAG:-none}" \
-f src/shadowbox/docker/Dockerfile \
-t "${SB_IMAGE:-outline/shadowbox}" \
-t "${SB_IMAGE:-localhost/outline/shadowbox}" \
"${ROOT_DIR}"
2 changes: 1 addition & 1 deletion src/shadowbox/docker/start.action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ declare -ar docker_bindings=(
-e "SB_METRICS_URL=${SB_METRICS_URL:-https://dev.metrics.getoutline.org}"
)

readonly IMAGE="${SB_IMAGE:-outline/shadowbox}"
readonly IMAGE="${SB_IMAGE:-localhost/outline/shadowbox}"
echo "Running image ${IMAGE}"

declare -a NET_BINDINGS=("--network=host")
Expand Down
15 changes: 15 additions & 0 deletions src/shadowbox/integration_test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Outline Server Image Integration Test

This folder contains the integration test for the Outline Server image.

To build and test the image:

```sh
npm run action shadowbox/integration_test/run
```

For development of the test, or to test a specific image, you may prefer calling the test directly, without the build step:

```sh
./src/shadowbox/integration_test/test.sh localhost/outline/shadowbox:latest
```
2 changes: 1 addition & 1 deletion src/shadowbox/integration_test/client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1-alpine
FROM docker.io/golang:1-alpine

# curl for fetching pages using the local proxy
RUN apk add --no-cache curl git
Expand Down
60 changes: 0 additions & 60 deletions src/shadowbox/integration_test/docker-compose.yml

This file was deleted.

2 changes: 1 addition & 1 deletion src/shadowbox/integration_test/run.action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ cd src/shadowbox/integration_test

declare -i result=0

if ./test.sh > "${LOGFILE}" 2>&1 ; then
if ./test.sh "${SB_IMAGE:-localhost/outline/shadowbox:latest}" > "${LOGFILE}" 2>&1 ; then
echo "Test Passed!"
# Removing the log file sometimes fails on Travis. There's no point in us cleaning it up
# on a CI build anyways.
Expand Down
2 changes: 2 additions & 0 deletions src/shadowbox/integration_test/target/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@

# Pin to a known good signed image to avoid failures from the Docker notary service
FROM gcr.io/distroless/python3@sha256:58087520b3c929fe77e1ef3fc95062dbe80bbda265e0e7966c4997c71a9636ea
# The python SimpleHTTPServer doesn't quit with SIGTERM, so we use SIGKILL.
STOPSIGNAL SIGKILL
COPY index.html .
ENTRYPOINT ["python", "-m", "http.server", "80"]
Loading

0 comments on commit 71e4b52

Please sign in to comment.