-
Notifications
You must be signed in to change notification settings - Fork 188
Feature: Add devcontainer support #1113
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
Open
yoursdearboy
wants to merge
5
commits into
getodk:next
Choose a base branch
from
yoursdearboy:devcontainer
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3bac716
Fix: don't check enketo keys size when ENV is DEV
yoursdearboy d5fe372
Fix: set PostgreSQL credentials in dev config to be the same as in se…
yoursdearboy ce1c696
Merge branch 'fix-start-enketo-in-dev' into devcontainer
yoursdearboy 56194f9
Merge branch 'fix-postgres-credentials-in-dev' into devcontainer
yoursdearboy d8f07f5
feat: add devcontainer support
yoursdearboy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
ARG node_version=22.14.0 | ||
|
||
|
||
|
||
FROM node:${node_version}-slim AS pgdg | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
ca-certificates \ | ||
curl \ | ||
gpg \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& update-ca-certificates | ||
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ $(grep -oP 'VERSION_CODENAME=\K\w+' /etc/os-release)-pgdg main" \ | ||
| tee /etc/apt/sources.list.d/pgdg.list \ | ||
&& curl https://www.postgresql.org/media/keys/ACCC4CF8.asc \ | ||
| gpg --dearmor > /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg | ||
|
||
|
||
|
||
# Use regular image instead of slim | ||
FROM node:${node_version} | ||
|
||
ARG node_version | ||
LABEL org.opencontainers.image.source="https://github.com/getodk/central" | ||
|
||
COPY --from=pgdg /etc/apt/sources.list.d/pgdg.list \ | ||
/etc/apt/sources.list.d/pgdg.list | ||
COPY --from=pgdg /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg \ | ||
/etc/apt/trusted.gpg.d/apt.postgresql.org.gpg | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
gpg \ | ||
cron \ | ||
wait-for-it \ | ||
procps \ | ||
postgresql-client-14 \ | ||
netcat-traditional \ | ||
git \ | ||
make \ | ||
nginx \ | ||
&& rm -rf /var/lib/apt/lists/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose | ||
{ | ||
"name": "ODK", | ||
|
||
// Update the 'dockerComposeFile' list if you have more compose files or use different names. | ||
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make. | ||
"dockerComposeFile": [ | ||
"../docker-compose.yml", | ||
"../docker-compose.dev.yml", | ||
"docker-compose.yml" | ||
], | ||
|
||
// The 'service' property is the name of the service for the container that VS Code should | ||
// use. Update this value and .devcontainer/docker-compose.yml to the real service name. | ||
"service": "service", | ||
|
||
// The optional 'workspaceFolder' property is the path VS Code should open by default when | ||
// connected. This is typically a file mount in .devcontainer/docker-compose.yml | ||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
|
||
// Uncomment the next line if you want start specific services in your Docker Compose config. | ||
"runServices": [ | ||
"postgres14", | ||
"service", | ||
"pyxform", | ||
"secrets", | ||
"enketo", | ||
"enketo_redis_main", | ||
"enketo_redis_cache" | ||
], | ||
"features": {} | ||
|
||
// Uncomment the next line if you want to keep your containers running after VS Code shuts down. | ||
// "shutdownAction": "none", | ||
|
||
// Uncomment the next line to run commands after the container is created. | ||
// "postCreateCommand": "cat /etc/os-release", | ||
|
||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
|
||
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "devcontainer" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# devcontainers don't support profiles, so we reset them. | ||
version: '3.8' | ||
services: | ||
# Update this to the name of the service you want to work with in your docker-compose.yml file | ||
service: | ||
# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer | ||
# folder. Note that the path of the Dockerfile and context is relative to the *primary* | ||
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile" | ||
# array). The sample below assumes your primary file is in the root of your project. | ||
# | ||
build: | ||
context: . | ||
dockerfile: .devcontainer/Dockerfile | ||
|
||
volumes: !override | ||
# Update this to wherever you want VS Code to mount the folder of your project | ||
- ..:/workspaces:cached | ||
# Mount secrets | ||
- dev_secrets:/etc/secrets | ||
|
||
# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust. | ||
# cap_add: | ||
# - SYS_PTRACE | ||
# security_opt: | ||
# - seccomp:unconfined | ||
|
||
# Overrides default command so things don't shut down after the process ends. | ||
command: sleep infinity | ||
|
||
profiles: !reset | ||
|
||
# because enketo needs to see odk and | ||
# nginx inside service needs to see enketo | ||
network_mode: service:enketo | ||
|
||
postgres14: | ||
profiles: !reset | ||
ports: !reset | ||
network_mode: service:enketo | ||
# just run database as usual, without upgrading | ||
command: docker-entrypoint.sh postgres | ||
postgres: | ||
profiles: !reset | ||
nginx: | ||
profiles: !reset | ||
mail: | ||
profiles: !reset | ||
pyxform: | ||
profiles: !reset | ||
secrets: | ||
profiles: !reset | ||
enketo: | ||
profiles: !reset | ||
enketo_redis_main: | ||
profiles: !reset | ||
enketo_redis_cache: | ||
profiles: !reset |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is already being discussed at #1110