Skip to content

chore: replace prettier with dprint #273

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

Merged
merged 5 commits into from
May 23, 2024
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
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

To add a new image, create a new folder in `images/` with the name of the image,
and create at least one `Dockerfile` for it, using an extension as the tag. For
instance, an Ubuntu-based version of your image would be in `Dockerfile.ubuntu`.
instance, an Ubuntu-based version of your image would be in `ubuntu.Dockerfile`.

New images should extend from existing images whenever possible, e.g.

Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Install Node.js modules
run: yarn install

- name: Check formatting
run: yarn format:check
uses: dprint/check@v2.2
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


images:
runs-on: ubuntu-latest
Expand Down
21 changes: 0 additions & 21 deletions .husky/pre-commit

This file was deleted.

2 changes: 0 additions & 2 deletions .prettierignore

This file was deleted.

11 changes: 0 additions & 11 deletions .prettierrc

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ This repository contains example images for use with [Coder](https://coder.com/d

- `enterprise-base`: Contains an example image that can be used as a base for
other images.
- `enterprise-minimal`: Contains a minimal image that contians only the required
- `enterprise-minimal`: Contains a minimal image that contians only the required
utilities for a Coder workspace to bootstrap successfully.

## Images on Docker Hub

Each of these images is also published to Docker Hub under the
`codercom/enterprise-[name]` repository. For example, `base` is available at
https://hub.docker.com/r/codercom/enterprise-base. The tag is taken from the
file extension of the Dockerfile. For example, `base/Dockerfile.ubuntu` is
filename of the Dockerfile. For example, `base/ubuntu.Dockerfile` is
under the `ubuntu` tag.

## Contributing
Expand Down
4 changes: 2 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

## BREAKING 02/15/2023

- Due to low usage, removed support for CentOS base images.
- Due to excessive vulnerabilities removed `brew` from Ubuntu images.
- Due to low usage, removed support for CentOS base images.
- Due to excessive vulnerabilities removed `brew` from Ubuntu images.
13 changes: 13 additions & 0 deletions dprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"markdown": {
},
"dockerfile": {
},
"excludes": [
"deprecated/*"
],
"plugins": [
"https://plugins.dprint.dev/markdown-0.17.0.wasm",
Copy link
Member

@matifali matifali May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we keep these updated? I don't think dependabot supports this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently there isn't any automated way, but apparently warning about outdated plugin versions is on the roadmap.

"https://plugins.dprint.dev/dockerfile-0.3.0.wasm"
]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ubuntu:22.04

SHELL ["/bin/bash", "-c"]
ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# Install the Docker apt repository
RUN apt-get update && \
Expand Down Expand Up @@ -37,7 +37,7 @@ RUN apt-get update && \
vim \
wget \
rsync && \
# Install latest Git using their official PPA
# Install latest Git using their official PPA
add-apt-repository ppa:git-core/ppa && \
apt-get install --yes git \
&& rm -rf /var/lib/apt/lists/*
Expand All @@ -49,7 +49,7 @@ RUN systemctl enable docker
RUN ln -s /usr/libexec/docker/cli-plugins/docker-compose /usr/bin/docker-compose

# Make typing unicode characters in the terminal work.
ENV LANG en_US.UTF-8
ENV LANG=en_US.UTF-8

# Add a user `coder` so that you're not developing as the `root` user
RUN useradd coder \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ubuntu:22.04

USER root
ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
bash \
Expand All @@ -19,5 +19,5 @@ RUN useradd coder \
--user-group && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers.d/nopasswd

ENV LANG en_US.UTF-8
ENV LANG=en_US.UTF-8
USER coder
2 changes: 1 addition & 1 deletion scripts/build_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fi

for image in "${IMAGES[@]}"; do
image_dir="$PROJECT_ROOT/images/$image"
image_file="Dockerfile.$TAG"
image_file="${TAG}.Dockerfile"
image_ref="codercom/enterprise-$image:$TAG"
image_path="$image_dir/$image_file"

Expand Down
12 changes: 12 additions & 0 deletions scripts/fmt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -euo pipefail

# shellcheck source=scripts/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
cdroot

check_dependencies dprint shfmt

dprint fmt
shfmt . >/dev/null 2>&1
17 changes: 12 additions & 5 deletions scripts/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

set -euo pipefail

# cdroot changes directory to the root of the repository.
cdroot() {
cd $(git rev-parse --show-toplevel)
}

# log prints a message to stderr.
log() {
echo "$*" 1>&2
}

# Emit a message to stderr and exit.
#
# This prints the arguments to stderr before exiting.
Expand All @@ -10,11 +20,8 @@ set -euo pipefail
# error "Missing flag abc"
# program-failure-info | error
function error() {
set +x
echo
echo "$@" "$(cat)" >&2
echo
exit 1
log "ERROR: $*"
exit 1
}

# Check if dependencies are available.
Expand Down
2 changes: 1 addition & 1 deletion scripts/push_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fi

for image in "${IMAGES[@]}"; do
image_dir="$PROJECT_ROOT/images/$image"
image_file="Dockerfile.$TAG"
image_file="${TAG}.Dockerfile"
image_ref="codercom/enterprise-$image:$TAG"
image_path="$image_dir/$image_file"

Expand Down
Loading