Skip to content

Commit

Permalink
fix: s3-client image draft
Browse files Browse the repository at this point in the history
  • Loading branch information
matmut7 committed Jul 31, 2023
1 parent 37beb4b commit 85c640a
Show file tree
Hide file tree
Showing 11 changed files with 128 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .github/workflows/s3-client.tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.ref }}-${{ github.event_name }}
jobs:
build:
uses: ./.github/workflows/workflow.build.yaml
secrets: inherit
with:
name: s3-client

version_test:
container: "docker://ghcr.io/socialgouv/docker/s3-client:sha-${{ github.sha }}"
name: Test Version
needs: [build]
runs-on: ubuntu-latest
steps:
- run: aws --version

name: "s3-client"
on:
push:
tags:
- "s3-client@**"
31 changes: 31 additions & 0 deletions .github/workflows/s3-client.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.ref }}-${{ github.event_name }}
jobs:
build:
uses: ./.github/workflows/workflow.build.yaml
secrets: inherit
with:
name: s3-client

version_test:
container: "docker://ghcr.io/socialgouv/docker/s3-client:sha-${{ github.sha }}"
name: Test Version
needs: [build]
runs-on: ubuntu-latest
steps:
- run: aws --version

name: "s3-client"
on:
push:
branches:
- "**"
- "!master"
- "!alpha"
- "!beta"
paths:
- "s3-client/**"
- ".github/workflows/s3-client.yaml"
- ".github/workflows/s3-client.tag.yaml"
- ".github/workflows/workflow.build.yaml"
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"wait-for-postgres",
"datasette",
"git",
"check-cluster-images"
"check-cluster-images",
"s3-client"
],
"packageManager": "[email protected]",
"private": true
Expand Down
10 changes: 10 additions & 0 deletions s3-client/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.{js,json,yml}]
charset = utf-8
indent_style = space
indent_size = 2
11 changes: 11 additions & 0 deletions s3-client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Swap the comments on the following lines if you don't wish to use zero-installs
# Documentation here: https://yarnpkg.com/features/zero-installs
!.yarn/cache
#.pnp.*
Empty file added s3-client/CHANGELOG.md
Empty file.
20 changes: 20 additions & 0 deletions s3-client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ARG UBUNTU_VERSION=22.04
FROM ubuntu:$UBUNTU_VERSION

# hadolint ignore=DL3008
RUN apt-get update && \
apt-get install -yq --no-install-recommends \
ca-certificates \
curl \
unzip \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*

RUN groupadd -g 1001 ubuntu && useradd -rm -d /home/ubuntu -s /bin/bash -g ubuntu -G sudo -u 1001 ubuntu
ENV HOME=/home/ubuntu

RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install

USER 1001
3 changes: 3 additions & 0 deletions s3-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# s3-client

Image with `psql` and `awscli`
11 changes: 11 additions & 0 deletions s3-client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "s3-client",
"packageManager": "[email protected]",
"scripts": {
"build": "docker build -t ${SG_DOCKER_IMAGE:-'socialgouv_docker_psql'} .",
"test": "yarn test:e2e && yarn test:structure",
"test:e2e": "$(yarn bin:bats) tests/*",
"test:structure": "$(yarn bin:container-structure-test) test --image ${SG_DOCKER_IMAGE:-'socialgouv_docker_psql'} --config tests/container-structure-test.yml -v debug"
},
"private": true
}
11 changes: 11 additions & 0 deletions s3-client/tests/container-structure-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
schemaVersion: "2.0.0"

commandTests:
- name: "psql version"
command: "psql"
args: ["--version"]
expectedOutput: ["psql \\(PostgreSQL\\) \\d+\\.\\d+"]
- name: "aws version"
command: "aws"
args: ["--version"]
expectedOutput: ["aws-cli.*"]
6 changes: 6 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5100,6 +5100,12 @@ __metadata:
languageName: node
linkType: hard

"s3-client@workspace:s3-client":
version: 0.0.0-use.local
resolution: "s3-client@workspace:s3-client"
languageName: unknown
linkType: soft

"safe-buffer@npm:~5.1.0, safe-buffer@npm:~5.1.1":
version: 5.1.2
resolution: "safe-buffer@npm:5.1.2"
Expand Down

0 comments on commit 85c640a

Please sign in to comment.