Skip to content

Commit 0eef40c

Browse files
committed
Move from docker to podman and ghcr.io. Add Zig
1 parent 4df7e60 commit 0eef40c

File tree

194 files changed

+2119
-1096
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+2119
-1096
lines changed

.github/workflows/master.yml

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ jobs:
1414

1515
env:
1616
MIX_ENV: test
17-
DOCKER_BUILDKIT: 1 # Enable buildkit for faster docker builds
1817

1918
services:
2019
db:
@@ -113,29 +112,20 @@ jobs:
113112
file: ./services/app/assp/codebattle/cover/excoveralls.json
114113
fail_ci_if_error: false
115114

116-
- name: Login to Docker Hub
117-
uses: docker/login-action@v3
118-
with:
119-
username: ${{ secrets.DOCKER_USERNAME }}
120-
password: ${{ secrets.DOCKER_PASSWORD }}
115+
- name: Install Podman
116+
run: |
117+
sudo apt-get update
118+
sudo apt-get -y install podman
121119
122-
- name: Set up Docker Buildx
123-
uses: docker/setup-buildx-action@v3
120+
- name: Login to Github Container Registry
121+
run: podman login ghcr.io -u vtm9 -p ${{ secrets.GH_REGISTRY_TOKEN }}
124122

125123
- name: Build and push codebattle image
126124
run: |
127-
make GIT_HASH=${{ github.sha }} docker-build-codebattle
128-
make docker-push-codebattle
125+
make GIT_HASH=${{ github.sha }} podman-build-codebattle
126+
make podman-push-codebattle
129127
130128
- name: Build and push runner image
131129
run: |
132-
make docker-build-runner
133-
make docker-push-runner
134-
135-
# stop integratoin tests on CI becaues of https://github.com/hexlet-codebattle/codebattle/runs/580337561?check_suite_focus=true
136-
# - name: Pull dockers
137-
# run: mix dockers.pull
138-
# working-directory: ./services/app
139-
140-
# - name: Run code checkers tests
141-
# run: make test-code-checkers
130+
make podman-build-runner
131+
make podman-push-runner

Makefile

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
include make-compose.mk
22

33
pg:
4-
docker compose up -d db-local
4+
podman compose up -d db-local
55

66
clean:
77
rm -rf services/app/_build
@@ -18,12 +18,12 @@ test-code-checkers:
1818
make -C ./services/app/ test-code-checkers
1919

2020
terraform-vars-generate:
21-
docker run --rm -it -v $(CURDIR):/app -w /app williamyeh/ansible:alpine3 ansible-playbook ansible/terraform.yml -i ansible/production -vv --vault-password-file=tmp/ansible-vault-password
21+
podman run --rm -it -v $(CURDIR):/app -w /app williamyeh/ansible:alpine3 ansible-playbook ansible/terraform.yml -i ansible/production -vv --vault-password-file=tmp/ansible-vault-password
2222

2323
setup: setup-env compose-setup
2424

2525
setup-env:
26-
docker run --rm -v $(CURDIR):/app -w /app williamyeh/ansible:alpine3 ansible-playbook ansible/development.yml -i ansible/development -vv
26+
podman run --rm -v $(CURDIR):/app -w /app williamyeh/ansible:alpine3 ansible-playbook ansible/development.yml -i ansible/development -vv
2727

2828
setup-env-local:
2929
ansible-playbook ansible/development.yml -i ansible/development -vv
@@ -32,97 +32,97 @@ ansible-edit-secrets:
3232
ansible-vault edit --vault-password-file tmp/ansible-vault-password ansible/production/group_vars/all/vault.yml
3333

3434
ansible-vault-edit-production:
35-
docker run --rm -it -v $(CURDIR):/app -w /app williamyeh/ansible:alpine3 ansible-vault edit --vault-password-file tmp/ansible-vault-password ansible/production/group_vars/all/vault.yml
35+
podman run --rm -it -v $(CURDIR):/app -w /app williamyeh/ansible:alpine3 ansible-vault edit --vault-password-file tmp/ansible-vault-password ansible/production/group_vars/all/vault.yml
3636

3737
release:
3838
make -C services/app release
3939

40-
docker-build-local:
41-
docker build --target assets-image \
42-
--file services/app/Dockerfile.codebattle \
40+
podman-build-local:
41+
podman build --target assets-image \
42+
--file services/app/Containerfile.codebattle \
4343
--build-arg GIT_HASH=$(GIT_HASH) \
4444
--tag codebattle/codebattle:assets-image services/app
45-
docker build --target compile-image \
46-
--file services/app/Dockerfile.codebattle \
45+
podman build --target compile-image \
46+
--file services/app/Containerfile.codebattle \
4747
--build-arg GIT_HASH=$(GIT_HASH) \
4848
--tag codebattle/codebattle:compile-image services/app
49-
docker build --target nginx-assets \
50-
--file services/app/Dockerfile.codebattle \
49+
podman build --target nginx-assets \
50+
--file services/app/Containerfile.codebattle \
5151
--tag codebattle/nginx-assets:latest services/app
52-
docker build --target runtime-image \
53-
--file services/app/Dockerfile.codebattle \
52+
podman build --target runtime-image \
53+
--file services/app/Containerfile.codebattle \
5454
--build-arg GIT_HASH=$(GIT_HASH) \
5555
--tag codebattle/codebattle:latest services/app
56-
docker build --target compile-image \
57-
--file services/app/Dockerfile.runner \
56+
podman build --target compile-image \
57+
--file services/app/Containerfile.runner \
5858
--tag codebattle/runner:compile-image services/app
59-
docker build --target runtime-image \
60-
--file services/app/Dockerfile.runner \
59+
podman build --target runtime-image \
60+
--file services/app/Containerfile.runner \
6161
--tag codebattle/runner:latest services/app
6262

63-
docker-build-codebattle:
64-
# docker pull codebattle/codebattle:assets-image || true
65-
# docker pull codebattle/codebattle:compile-image || true
66-
# docker pull codebattle/codebattle:latest || true
67-
docker build --target assets-image \
68-
--file services/app/Dockerfile.codebattle \
63+
podman-build-codebattle:
64+
# podman pull codebattle/codebattle:assets-image || true
65+
# podman pull codebattle/codebattle:compile-image || true
66+
# podman pull codebattle/codebattle:latest || true
67+
podman build --target assets-image \
68+
--file services/app/Containerfile.codebattle \
6969
--build-arg GIT_HASH=$(GIT_HASH) \
7070
--tag codebattle/codebattle:assets-image services/app
71-
docker build --target compile-image \
72-
--file services/app/Dockerfile.codebattle \
71+
podman build --target compile-image \
72+
--file services/app/Containerfile.codebattle \
7373
--build-arg GIT_HASH=$(GIT_HASH) \
7474
--tag codebattle/codebattle:compile-image services/app
75-
docker build --target nginx-assets \
76-
--file services/app/Dockerfile.codebattle \
75+
podman build --target nginx-assets \
76+
--file services/app/Containerfile.codebattle \
7777
--tag codebattle/nginx-assets:latest services/app
78-
docker build --target runtime-image \
79-
--file services/app/Dockerfile.codebattle \
78+
podman build --target runtime-image \
79+
--file services/app/Containerfile.codebattle \
8080
--build-arg GIT_HASH=$(GIT_HASH) \
8181
--tag codebattle/codebattle:latest services/app
8282

83-
docker-build-arm:
84-
docker build --platform linux/arm64 \
83+
podman-build-arm:
84+
podman build --platform linux/arm64 \
8585
--target assets-image \
86-
--file services/app/Dockerfile.codebattle \
86+
--file services/app/Containerfile.codebattle \
8787
--build-arg GIT_HASH=$(GIT_HASH) \
8888
--tag codebattle/codebattle:assets-image-arm services/app
89-
docker build --platform linux/arm64 \
89+
podman build --platform linux/arm64 \
9090
--target compile-image \
91-
--file services/app/Dockerfile.codebattle \
91+
--file services/app/Containerfile.codebattle \
9292
--build-arg GIT_HASH=$(GIT_HASH) \
9393
--tag codebattle/codebattle:compile-image-arm services/app
94-
docker build --platform linux/arm64 \
94+
podman build --platform linux/arm64 \
9595
--target nginx-assets \
96-
--file services/app/Dockerfile.codebattle \
96+
--file services/app/Containerfile.codebattle \
9797
--tag codebattle/nginx-assets:arm services/app
98-
docker build --platform linux/arm64 \
98+
podman build --platform linux/arm64 \
9999
--target runtime-image \
100-
--file services/app/Dockerfile.codebattle \
100+
--file services/app/Containerfile.codebattle \
101101
--build-arg GIT_HASH=$(GIT_HASH) \
102102
--tag codebattle/codebattle:arm services/app
103103

104-
docker-push-codeabttle-arm:
105-
docker push codebattle/codebattle:assets-image-arm
106-
docker push codebattle/codebattle:compile-image-arm
107-
docker push codebattle/codebattle:arm
108-
docker push codebattle/nginx-assets:arm
109-
110-
docker-push-codebattle:
111-
docker push codebattle/codebattle:assets-image
112-
docker push codebattle/codebattle:compile-image
113-
docker push codebattle/codebattle:latest
114-
docker push codebattle/nginx-assets:latest
115-
116-
docker-build-runner:
117-
# docker pull codebattle/runner:compile-image || true
118-
# docker pull codebattle/runner:latest || true
119-
docker build --target compile-image \
120-
--file services/app/Dockerfile.runner \
104+
podman-push-codeabttle-arm:
105+
podman push codebattle/codebattle:assets-image-arm
106+
podman push codebattle/codebattle:compile-image-arm
107+
podman push codebattle/codebattle:arm
108+
podman push codebattle/nginx-assets:arm
109+
110+
podman-push-codebattle:
111+
podman push codebattle/codebattle:assets-image
112+
podman push codebattle/codebattle:compile-image
113+
podman push codebattle/codebattle:latest
114+
podman push codebattle/nginx-assets:latest
115+
116+
podman-build-runner:
117+
# podman pull codebattle/runner:compile-image || true
118+
# podman pull codebattle/runner:latest || true
119+
podman build --target compile-image \
120+
--file services/app/Containerfile.runner \
121121
--tag codebattle/runner:compile-image services/app
122-
docker build --target runtime-image \
123-
--file services/app/Dockerfile.runner \
122+
podman build --target runtime-image \
123+
--file services/app/Containerfile.runner \
124124
--tag codebattle/runner:latest services/app
125125

126-
docker-push-runner:
127-
docker push codebattle/runner:compile-image
128-
docker push codebattle/runner:latest
126+
podman-push-runner:
127+
podman push codebattle/runner:compile-image
128+
podman push codebattle/runner:latest

README.md

Lines changed: 66 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This project exists thanks to all the people who contribute. [Contribute guideli
1919
### Requirements
2020

2121
- Mac / Linux
22-
- docker
22+
- podman
2323

2424
### Install
2525

@@ -59,18 +59,18 @@ $ make compose-lint-js-fix
5959
```bash
6060
$ mix upload_langs
6161

62-
$ mix dockers.push # all
63-
$ mix dockers.push elixir
62+
$ mix images.push # all
63+
$ mix images.push elixir
6464

65-
$ mix dockers.build # all
66-
$ mix dockers.build elixir
65+
$ mix images.build # all
66+
$ mix images.build elixir
6767

68-
$ mix dockers.pull # all
69-
$ mix dockers.pull elixir
68+
$ mix images.pull # all
69+
$ mix images.pull elixir
7070

7171
$ mix asserts.upload # Pulls from battle_asserts all issues and upserts into DB
7272

73-
#If you use docker in dev env, run commands in make compose-bash
73+
#If you use images in dev env, run commands in make compose-bash
7474
```
7575

7676
### Profile js bundle
@@ -87,42 +87,84 @@ yarn profile:visualize
8787

8888
### Troubleshooting
8989

90-
- Install and run docker
90+
#### macOS
9191

92-
Make sure you have installed `docker` for your OS.
92+
- Install podman
9393

94-
https://docs.docker.com/install/
95-
96-
Make sure your docker daemon is running. You can run it manually by typing:
94+
Make sure you have installed `podman` for macOS.
9795

96+
```bash
97+
brew install podman
9898
```
99-
sudo dockerd
99+
100+
Or follow the official installation guide: https://podman.io/getting-started/installation
101+
102+
- Initialize and start podman machine
103+
104+
On macOS, podman requires a virtual machine to run containers. Initialize and start it:
105+
106+
```bash
107+
podman machine init
108+
podman machine start
100109
```
101110

102-
or you can add it to startup by typing:
111+
If you encounter issues, try removing and reinitializing the machine:
103112

113+
```bash
114+
podman machine stop
115+
podman machine rm
116+
podman machine init
117+
podman machine start
104118
```
105-
sudo systemctl enable docker
119+
120+
- Set podman machine to start automatically
121+
122+
To have the podman machine start automatically on boot:
123+
124+
```bash
125+
podman machine set --rootful=false
106126
```
107127

108-
Close and open your terminal if docker daemon didn't start immediately.
128+
Close and open your terminal if podman didn't start immediately.
109129

110-
- Manage Docker as a non-root user
130+
#### Linux
111131

112-
https://docs.docker.com/install/linux/linux-postinstall/
132+
- Install podman
113133

114-
Create the docker group.
134+
Make sure you have installed `podman` for your Linux distribution.
115135

116-
```
117-
sudo groupadd docker
136+
https://podman.io/getting-started/installation
137+
138+
- Start podman service
139+
140+
Make sure podman is running. You can start the podman service manually by typing:
141+
142+
```bash
143+
sudo systemctl start podman
118144
```
119145

120-
Add your user to the docker group.
146+
or you can add it to startup by typing:
121147

148+
```bash
149+
sudo systemctl enable podman
122150
```
123-
sudo usermod -aG docker $USER
151+
152+
Close and open your terminal if podman didn't start immediately.
153+
154+
- Running podman in rootless mode
155+
156+
Podman can run containers without root privileges by default. If you encounter permission issues, ensure your user is set up for rootless podman:
157+
158+
https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md
159+
160+
You may need to configure subuid and subgid mappings:
161+
162+
```bash
163+
sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $USER
124164
```
125165

166+
Then restart your session for the changes to take effect.
167+
126168
## Star History
127169

128170
[![Star History Chart](https://api.star-history.com/svg?repos=hexlet-codebattle/codebattle&type=Date)](https://star-history.com/#hexlet-codebattle/codebattle&Date)

docker-compose.yml renamed to compose.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ services:
22
app:
33
build:
44
context: services/app
5-
dockerfile: Dockerfile.dev
5+
dockerfile: Containerfile.dev
66
working_dir: /app
77
tty: true # allocates a pseudo-TTY for interactive IEx
88
stdin_open: true # keeps STDIN open even if not attached
@@ -14,12 +14,11 @@ services:
1414
- "${CODEBATTLE_PORT}:${CODEBATTLE_PORT}"
1515
- "8080:8080"
1616
volumes:
17-
- "./services/app:/app:delegated"
18-
- "~/.bash_history:/root/.bash_history:delegated"
19-
- ".bashrc:/root/.bashrc:delegated"
20-
- "/var/run/docker.sock:/var/run/docker.sock:cached"
21-
- "/var/tmp:/var/tmp:delegated"
22-
- "/tmp:/tmp:delegated"
17+
- "./services/app:/app:z"
18+
- "~/.bash_history:/root/.bash_history:z"
19+
- ".bashrc:/root/.bashrc:z"
20+
- "/var/tmp:/var/tmp:z"
21+
- "/tmp:/tmp:z"
2322
depends_on:
2423
- db
2524

docs/001_product_review.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ Tournament grades: open, rookie, challenger, pro, elite, masters, grand_slam —
1414

1515
Seasons: Four per year aligned to equinoxes/solstices. Season points reset each season; lifetime Elo never resets.
1616

17-
Languages: 16 supported — clojure, cpp, csharp, dart, elixir, golang, haskell, java, js, kotlin, php, python, ruby, rust, swift, ts.
17+
Languages: 16 supported — clojure, cpp, csharp, dart, elixir, golang, haskell, java, js, kotlin, php, python, ruby, rust, swift, ts, zig.

0 commit comments

Comments
 (0)