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

[SQLite] [CC-1642] Upgrade Gleam to 1.9 #126

Merged
merged 1 commit into from
Mar 11, 2025
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 compiled_starters/gleam/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Time to move on to the next stage!

Note: This section is for stages 2 and beyond.

1. Ensure you have `gleam (1.0+)` installed locally
1. Ensure you have `gleam (1.9.1)` installed locally
1. Run `./your_program.sh` to run your program, which is implemented in
`src/main.gleam`.
1. Commit your changes and run `git push origin master` to submit your solution
Expand Down
4 changes: 2 additions & 2 deletions compiled_starters/gleam/codecrafters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ debug: false
# Use this to change the Gleam version used to run your code
# on Codecrafters.
#
# Available versions: gleam-1.6
language_pack: gleam-1.6
# Available versions: gleam-1.9
language_pack: gleam-1.9
17 changes: 17 additions & 0 deletions dockerfiles/gleam-1.9.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# syntax=docker/dockerfile:1.7-labs
FROM ghcr.io/gleam-lang/gleam:v1.9.1-erlang-alpine

# Rebuild if gleam.toml or manifest.toml change
ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="gleam.toml,manifest.toml"

WORKDIR /app

# .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses
COPY --exclude=.git --exclude=README.md . /app
Comment on lines +9 to +10
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Fix COPY Command Invalid Flag Usage
The COPY command uses unsupported flags (--exclude), which is flagged by static analysis. Docker does not support --exclude on the COPY instruction. Instead, use a .dockerignore file to exclude .git and README.md. For example:

-COPY --exclude=.git --exclude=README.md . /app
+COPY . /app

Then, create a .dockerignore file (if not already present) at the repository root with the following entries:

.git
README.md

This approach will prevent the specified files from being copied into the image and avoid cache misses.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses
COPY --exclude=.git --exclude=README.md . /app
# .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses
COPY . /app
🧰 Tools
🪛 Hadolint (2.12.0)

[error] 10-10: invalid flag: --exclude

(DL1000)


# Force deps to be downloaded
RUN gleam build

# Cache build directory
RUN mkdir -p /app-cached
RUN mv build /app-cached/build
2 changes: 1 addition & 1 deletion solutions/gleam/01-dr6/code/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Time to move on to the next stage!

Note: This section is for stages 2 and beyond.

1. Ensure you have `gleam (1.0+)` installed locally
1. Ensure you have `gleam (1.9.1)` installed locally
1. Run `./your_program.sh` to run your program, which is implemented in
`src/main.gleam`.
1. Commit your changes and run `git push origin master` to submit your solution
Expand Down
4 changes: 2 additions & 2 deletions solutions/gleam/01-dr6/code/codecrafters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ debug: false
# Use this to change the Gleam version used to run your code
# on Codecrafters.
#
# Available versions: gleam-1.6
language_pack: gleam-1.6
# Available versions: gleam-1.9
language_pack: gleam-1.9
2 changes: 1 addition & 1 deletion starter_templates/gleam/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
attributes:
required_executable: gleam (1.0+)
required_executable: gleam (1.9.1)
user_editable_file: src/main.gleam
Loading